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:10:00 UTC

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

     [ https://issues.apache.org/jira/browse/AVRO-3015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Feroze Daud updated AVRO-3015:
------------------------------
    Description: 
I have a simple schema as follows: 
{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.

 

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

!Screen Shot 2020-12-29 at 7.06.36 PM.png!

 

  was:
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.

 


> 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
>            Priority: Major
>         Attachments: Screen Shot 2020-12-29 at 7.06.36 PM.png
>
>
> I have a simple schema as follows: 
> {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.
>  
> Here is the image from the debugger window of my IntelliJ IDe
> !Screen Shot 2020-12-29 at 7.06.36 PM.png!
>  



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