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

Can't use ReflectData to get schema when the type has a BigDecimal or BigInteger field

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.0
    • Fix Version/s: 1.7.2
    • Component/s: java
    • Labels:

      Description

      I'm using avro Reflection API for a specific use case and I have a bug where if the object I'm trying to get the Schema for has a field of type BigDecimal. Because BigDecimal extends java.lang.Number, we try to create a primitive schema for it but fail doing so with the following error:

      org.apache.avro.AvroRuntimeException: Not a Specific class: class java.math.BigDecimal

      I'm attaching a unit test that shows the problem with a basic type that has a single BigDecimal field.

      This basically also applied to all subclasses of java.lang.Number that are not primitives.

        Attachments

        1. AVRO-1146.java
          5 kB
          Doug Cutting
        2. AVRO-1146.patch
          4 kB
          Doug Cutting
        3. AVRO-1146.patch
          6 kB
          Alexandre Normand
        4. TestReflectDataWithBigDecimal.java
          0.8 kB
          Alexandre Normand

          Activity

            People

            • Assignee:
              alexandre.normand Alexandre Normand
              Reporter:
              alexandre.normand Alexandre Normand
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: