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

ASF subversion and git services commented on AVRO-2976:
-------------------------------------------------------

Commit becde91a74fc720443e1dfa5ed560c336271d47e in avro's branch 
refs/heads/branch-1.11 from Oscar Westra van Holthe - Kind
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=becde91 ]

AVRO-2976: Add LogicalType parsing to the IDL (#985)

* AVRO-2976: Add LogicalType parsing to IDL

* AVRO-2976: Handle both Long and Integer in IDL JSON parsing

The IDL parser now distinguishes numbers between Long and Integer. This
is needed because the logical type decimal breaks on Long numbers for
precision and scale.

I chose to solve it here because the scope of this change is smaller. An
alternative is to downcast a Long in the method
LogicalTypes.Decimal#getInt(Schema, String).

* AVRO-2976: Remove duplicate annotation processing for types.

* Extend simple test to also verify annotations on arrays (the grammar alrewady 
supports this).

* AVRO-2976: Trigger tests (build fail on unrelated part)

* AVRO-2976: Revert pom.xml change.

* AVRO-2976: Fix copy/paste error

* AVRO-2976: Remove debugging code

The removed code was used to evaluate if the test would work.

* AVRO-2976: Spotless

* AVRO-2976: Fix test

The test worked because calling toString() on the protocol made schemas
available by their unqualified name (without namespace).

> 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)

Reply via email to