Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-1895

DeepCopy does not work with logical types

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.8.1
    • Fix Version/s: 1.9.0, 1.8.2
    • Component/s: logical types
    • Labels:
      None

      Description

      AvroSchema is taken from a compiled avsc file which contains a decimal field.

      AvroSchema.Builder builder = AvroSchema.newBuilder();
      BigDecimal bd = new BigDecimal(new BigInteger("155"), 3);
      campaignBuilder.setDecimalField(bd);
      AvroSchema source = builder.build();
      
      //This line causes an exception
      AvroSchema.Builder builder1 = AvroSchema.newBuilder(source);
      

      Exception:

      InvocationTargetException: java.math.BigDecimal cannot be cast to java.nio.ByteBuffer
      

      The same failure happens with GenericData as well:

      GenericRecord copy = GenericData.get().deepCopy(AvroSchema.getClassSchema(), source);
      

        Attachments

        1. AVRO-1895.patch
          5 kB
          Doug Cutting
        2. AVRO-1895.patch
          5 kB
          Doug Cutting
        3. AVRO-1895.patch
          7 kB
          Doug Cutting
        4. AVRO-1895.patch
          7 kB
          Doug Cutting

          Issue Links

            Activity

              People

              • Assignee:
                cutting Doug Cutting
                Reporter:
                tarasbob Taras Bobrovytsky
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: