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

Oscar Westra van Holthe - Kind commented on AVRO-2864:
------------------------------------------------------

The array schema can also have properties. This means that the property is 
placed correctly.

To have the logical type on the array elements, you'd have to use this:
{code:java}
protocol _ {
                record R {
                        array<@logicalType("timestamp-micros") long> times;
                }
        }
}{code}
 

> IDL does not fully support arbitrary logical types
> --------------------------------------------------
>
>                 Key: AVRO-2864
>                 URL: https://issues.apache.org/jira/browse/AVRO-2864
>             Project: Apache Avro
>          Issue Type: Bug
>            Reporter: Roger
>            Priority: Major
>
> There seems to be no way to specify a logical type other than the ones built 
> in to IDL (decimal, date, time-millis, timestamp-millis) when the type is not 
> used at the top level in a field.
> For example, it is not possible to specify an array of long with logical type 
> timestamp-micros.
> If you do:
> {code:none}
> protocol _ {
>               record R {
>                       @logicalType("timestamp-micros")
>                       array<long> times;
>               }
>       }
> }
> {code}
> the "logicalType" attribute will be associated with the array type and not 
> the element type.
> The resulting AVSC (as converted by the idl2schemata tool) looks like this:
> {code:json}
>     {
>       "type" : "record",
>       "name" : "R",
>       "fields" : [ {
>         "name" : "times",
>         "type" : {
>           "type" : "array",
>           "items" : "long",
>           "logicalType" : "timestamp-micros"
>         }
>       } ]
>     }
> {code}
> I would expect the logical type to be associated with the element type, but 
> even if the tool is changed to do that, it's still not complete, because 
> there's no way to associate a logical type with a member of a union.



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

Reply via email to