You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Feroze Daud (Jira)" <ji...@apache.org> on 2020/12/30 03:09:00 UTC

[jira] [Created] (AVRO-3015) Java SchemaParser doesnt seem to honor logicalType annotation

Feroze Daud created AVRO-3015:
---------------------------------

             Summary: Java SchemaParser doesnt seem to honor logicalType annotation
                 Key: AVRO-3015
                 URL: https://issues.apache.org/jira/browse/AVRO-3015
             Project: Apache Avro
          Issue Type: Bug
          Components: java, logical types
    Affects Versions: 1.9.0
            Reporter: Feroze Daud
         Attachments: Screen Shot 2020-12-29 at 7.06.36 PM.png

I have a simple schema as follows: !Screen Shot 2020-12-29 at 7.06.36 PM.png!
{noformat}
{
  "type" : "record",
  "name" : "LogicalTypeDate",
  "namespace" : "com.zillow.avro",
  "fields" : [
      {
        "name" : "type",
        "type" : "string"
      }, {
        "name" : "modifiedDate",
        "type" : "int",
        "logicalType": "date"
      }
  ]
} {noformat}
 

I am reading it in java as follows:
{noformat}
org.apache.avro.Schema.Parser parser = new Schema.Parser();
Schema schema = parser.parse(this.getClass().getClassLoader().getResourceAsStream(schemaFile));
{noformat}
 

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.

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)