[ https://issues.apache.org/jira/browse/AVRO-2976?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ryan Skraba updated AVRO-2976: ------------------------------ Resolution: Fixed Status: Resolved (was: Patch Available) Cherry-picked to [branch-1.11|https://github.com/apache/avro/commit/becde91a74fc720443e1dfa5ed560c336271d47e] Thanks for this fix! > IDL parsing does not support arbitrary logical types > ---------------------------------------------------- > > Key: AVRO-2976 > URL: https://issues.apache.org/jira/browse/AVRO-2976 > Project: Apache Avro > Issue Type: Improvement > Components: java, logical types, tools > Affects Versions: 1.8.2, 1.10.0, 1.9.2, 1.10.1, 1.10.2 > Reporter: Oscar Westra van Holthe - Kind > Assignee: Oscar Westra van Holthe - Kind > Priority: Major > Labels: pull-request-available > Fix For: 1.11.1 > > Attachments: avro2976.zip > > Time Spent: 3h > Remaining Estimate: 0h > > When parsing Avro IDL in code, the resulting protocol types (schemas) have no > logical types defined, when though the properties for them are set. > > Example IDL: > {code:java} > protocol P { > record R { > @logicalType("timestamp-micros") long uTime; > } > }{code} > > The following test fails on the second assert: > {code:java} > @Test > public void validateIdlLogicalTypeParsing() { > final ClassLoader cl = Thread.currentThread().getContextClassLoader(); > Idl idl = new Idl(cl.getResourceAsStream("logicalTypes.avdl"), "UTF-8"); > Protocol protocol = idl.CompilationUnit(); > Schema fieldSchema = protocol.getType("R").getField("uTime").schema(); > Assert.assertEquals("timestamp-micros", > fieldSchema.getObjectProp("logicalType")); > Assert.assertNotNull(fieldSchema.getLogicalType()); > } > {code} > > A minimal proof is attached. -- This message was sent by Atlassian Jira (v8.20.1#820001)