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

Java SchemaParser doesnt seem to honor logicalType annotation

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Not A Bug
    • Affects Version/s: 1.9.0
    • Fix Version/s: None
    • Component/s: java, logical types
    • Labels:
      None

      Description

      I have a simple schema as follows: 

      {
        "type" : "record",
        "name" : "LogicalTypeDate",
        "namespace" : "com.zillow.avro",
        "fields" : [
            {
              "name" : "type",
              "type" : "string"
            }, {
              "name" : "modifiedDate",
              "type" : "int",
              "logicalType": "date"
            }
        ]
      } 

       

      I am reading it in java as follows:

      org.apache.avro.Schema.Parser parser = new Schema.Parser();
      Schema schema = parser.parse(this.getClass().getClassLoader().getResourceAsStream(schemaFile));
      

       

      When I look at the resultant Schema object, and look at the fields, I see "logicalType" is NULL for the "modifiedDate" field.

      I would have expected the field to be set correctly.

       

      Here is the image from the debugger window of my IntelliJ IDe

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                ferozedaud Feroze Daud
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: