Teodor Kostov created AVRO-2520: ----------------------------------- Summary: Schema parsing does not work for non-record types with logicalType Key: AVRO-2520 URL: https://issues.apache.org/jira/browse/AVRO-2520 Project: Apache Avro Issue Type: Bug Components: java Affects Versions: 1.9.0 Reporter: Teodor Kostov
Parsing the following schema fails: {code:java} new Schema.Parser().parse("{ \"name\": \"test\", \"type\": { \"type\": \"long\", \"logicalType\": \"MY_TIMESTAMP\" }}") {code} with the following exception: {noformat} No type: {"name":"test","type":{"type":"long","logicalType":"MY_TIMESTAMP"}} org.apache.avro.SchemaParseException: No type: {"name":"test","type":{"type":"long","logicalType":"MY_TIMESTAMP"}} at org.apache.avro.Schema.getRequiredText(Schema.java:1725) at org.apache.avro.Schema.parse(Schema.java:1576) at org.apache.avro.Schema$Parser.parse(Schema.java:1366) at org.apache.avro.Schema$Parser.parse(Schema.java:1354) {noformat} The complex type cannot be properly parsed because it is not a simple string but a JSON object. Hence when calling `jsonNode.textValue()` the result is null. Check `getOptionalText(...)` for more information. When supplying logical types it should be possible to parse a simple schema. -- This message was sent by Atlassian Jira (v8.3.2#803003)