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

Java SchemaParser doesnt seem to honor logicalType annotation

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Not A Bug
    • 1.9.0
    • None
    • java, logical types
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: