You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Oscar Westra van Holthe - Kind (Jira)" <ji...@apache.org> on 2021/02/02 15:45:00 UTC

[jira] [Updated] (AVRO-2976) IDL parsing does not support arbitrary logical types

     [ https://issues.apache.org/jira/browse/AVRO-2976?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oscar Westra van Holthe - Kind updated AVRO-2976:
-------------------------------------------------
    Description: 
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}
 

  was:
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.assertNull(fieldSchema.getLogicalType());
}
{code}
 


> 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
>    Affects Versions: 1.8.2, 1.10.0, 1.9.2
>            Reporter: Oscar Westra van Holthe - Kind
>            Priority: Major
>         Attachments: avro2976.zip
>
>
> 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}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)