You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Roger (Jira)" <ji...@apache.org> on 2020/06/19 07:52:00 UTC

[jira] [Updated] (AVRO-2864) IDL does not fully support arbitrary logical types

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

Roger updated AVRO-2864:
------------------------
    Description: 
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:

{{	protocol _ {
		record R {
			@logicalType("timestamp-micros")
			array<long> times;
		}
	}
}}
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:

{{    {
      "type" : "record",
      "name" : "R",
      "fields" : [ {
        "name" : "times",
        "type" : {
          "type" : "array",
          "items" : "long",
          "logicalType" : "timestamp-micros"
        }
      } ]
    }
}}
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.


  was:
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:

	protocol _ {
		record R {
			@logicalType("timestamp-micros")
			array<long> times;
		}
	}

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:

    {
      "type" : "record",
      "name" : "R",
      "fields" : [ {
        "name" : "times",
        "type" : {
          "type" : "array",
          "items" : "long",
          "logicalType" : "timestamp-micros"
        }
      } ]
    }

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.



> 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:
> {{	protocol _ {
> 		record R {
> 			@logicalType("timestamp-micros")
> 			array<long> times;
> 		}
> 	}
> }}
> 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:
> {{    {
>       "type" : "record",
>       "name" : "R",
>       "fields" : [ {
>         "name" : "times",
>         "type" : {
>           "type" : "array",
>           "items" : "long",
>           "logicalType" : "timestamp-micros"
>         }
>       } ]
>     }
> }}
> 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)