[ 
https://issues.apache.org/jira/browse/AVRO-2520?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16967699#comment-16967699
 ] 

Teodor Kostov commented on AVRO-2520:
-------------------------------------

Thanks [~ryanskraba]. It seems that the syntax is much simpler.

I'm closing this issue.

> 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
>            Priority: Minor
>
> 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.4#803005)

Reply via email to