You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Teodor Kostov (Jira)" <ji...@apache.org> on 2019/08/23 12:54:00 UTC
[jira] [Resolved] (AVRO-2521) When parsing a schema the logical
type is not properly set for the result instance
[ https://issues.apache.org/jira/browse/AVRO-2521?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Teodor Kostov resolved AVRO-2521.
---------------------------------
Fix Version/s: 1.9.0
Resolution: Invalid
The LogicalTypeFactory was not registered.
> 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
> Priority: Minor
> Fix For: 1.9.0
>
>
> 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)