[
https://issues.apache.org/jira/browse/AVRO-2380?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Harshvardhan Agrawal updated AVRO-2380:
---------------------------------------
Affects Version/s: 1.8.2
Description:
{code:java}
{
"name" : "data",
"type" : {
"type" : "map",
"values" : {
"type" : "array",
"items" : {
"type" : "map",
"values" : [ "string", "long", "null", "double", "float", "int", "boolean" ]
}
}
}{code}
The above schema represents a List<Map<String, Object>> where the values of the
map could be any of the basic datatypes supported by Avro.
If we want the Map to support logical types such as timestamp for e.g.
{code:java}
{
"name" : "data",
"type" : {
"type" : "map",
"values" : {
"type" : "array",
"items" : {
"type" : "map",
"values" : [ "string", "long", "null", "double", "float", "int", "boolean",
{ "type" : "long", "logicalType" : "timestamp-micros" }]
}
}
}{code}
The schema parser fails with the following error:
{code:java}
Exception in thread "main" org.apache.avro.AvroRuntimeException: Duplicate in
union:long at org.apache.avro.Schema$UnionSchema.<init>(Schema.java:854)
at org.apache.avro.Schema.parse(Schema.java:1341)
at org.apache.avro.Schema.parse(Schema.java:1311)
at org.apache.avro.Schema.parse(Schema.java:1306)
at org.apache.avro.Schema.parse(Schema.java:1311)
at org.apache.avro.Schema.parse(Schema.java:1269)
at org.apache.avro.Schema$Parser.parse(Schema.java:1032)
at org.apache.avro.Schema$Parser.parse(Schema.java:1020)
{code}
Summary: Logical types are not supported when the actual datatype
is also present in Union (was: Unions don)
> Logical types are not supported when the actual datatype is also present in
> Union
> ---------------------------------------------------------------------------------
>
> Key: AVRO-2380
> URL: https://issues.apache.org/jira/browse/AVRO-2380
> Project: Apache Avro
> Issue Type: Bug
> Affects Versions: 1.8.2
> Reporter: Harshvardhan Agrawal
> Priority: Major
>
> {code:java}
> {
> "name" : "data",
> "type" : {
> "type" : "map",
> "values" : {
> "type" : "array",
> "items" : {
> "type" : "map",
> "values" : [ "string", "long", "null", "double", "float", "int", "boolean"
> ]
> }
> }
> }{code}
> The above schema represents a List<Map<String, Object>> where the values of
> the map could be any of the basic datatypes supported by Avro.
> If we want the Map to support logical types such as timestamp for e.g.
> {code:java}
> {
> "name" : "data",
> "type" : {
> "type" : "map",
> "values" : {
> "type" : "array",
> "items" : {
> "type" : "map",
> "values" : [ "string", "long", "null", "double", "float", "int", "boolean",
> { "type" : "long", "logicalType" : "timestamp-micros" }]
> }
> }
> }{code}
> The schema parser fails with the following error:
>
> {code:java}
> Exception in thread "main" org.apache.avro.AvroRuntimeException: Duplicate in
> union:long at org.apache.avro.Schema$UnionSchema.<init>(Schema.java:854)
> at org.apache.avro.Schema.parse(Schema.java:1341)
> at org.apache.avro.Schema.parse(Schema.java:1311)
> at org.apache.avro.Schema.parse(Schema.java:1306)
> at org.apache.avro.Schema.parse(Schema.java:1311)
> at org.apache.avro.Schema.parse(Schema.java:1269)
> at org.apache.avro.Schema$Parser.parse(Schema.java:1032)
> at org.apache.avro.Schema$Parser.parse(Schema.java:1020)
> {code}
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)