You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Ryan Skraba (Jira)" <ji...@apache.org> on 2019/08/23 16:00:00 UTC
[jira] [Commented] (AVRO-2520) Schema parsing does not work for
non-record types with logicalType
[ https://issues.apache.org/jira/browse/AVRO-2520?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16914409#comment-16914409 ]
Ryan Skraba commented on AVRO-2520:
-----------------------------------
I don't think this is related to logical types. Is it possible that you are looking for :
{code}
new Schema.Parser().parse(" {\"type\": \"long\", \"logicalType\": \"MY_TIMESTAMP\" }")
{code}
If you just want the plain, non-record datum, this would be the way to go.
> 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.2#803003)