Teodor Kostov created AVRO-2521:
-----------------------------------

             Summary: When parsing a schema the logical type is not properly 
set for the result instance
                 Key: AVRO-2521
                 URL: https://issues.apache.org/jira/browse/AVRO-2521
             Project: Apache Avro
          Issue Type: Bug
          Components: java
    Affects Versions: 1.9.0
            Reporter: Teodor Kostov


When the following schema is parsed:
{code:java}
Schema schema = new Schema.Parser().parse("{ \"name\": \"test\", \"type\": 
\"record\", \"fields\": [{ \"name\": \"time\", \"type\": { \"type\": \"long\", 
\"logicalType\": \"MY_TIMESTAMP\" }}]}");
{code}

the `logicalType` is not properly initialized for the schema object of the 
`time` field. This means that:
{code:java}
Schema timeSchema = schema.getField("time").schema();

assert(null == timeSchema.getLogicalType());
assert(null != timeSchema.getObjectProp(LogicalType.LOGICAL_TYPE_PROP))
{code}

The private schema value representing the logical type is still `null`. 
However, the property map is properly filled with a `LOGICAL_TYPE_PROP`.

Such a schema is unusable because the client of the library cannot fix the 
logical type afterwards.
{code:java}
myLogicalType.addToSchema(timeSchema); // BOOM
{code}




--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to