You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Andreas Christodoulou (JIRA)" <ji...@apache.org> on 2018/01/04 10:55:00 UTC
[jira] [Updated] (AVRO-2125) AvroRuntimeException: Not a union
[ https://issues.apache.org/jira/browse/AVRO-2125?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andreas Christodoulou updated AVRO-2125:
----------------------------------------
Description:
I have an Avro schema which I am using as part of our Apache Beam pipeline tests, and using the avro-tools-1.8.2 tool I have generated random data from the Avro schema. In the tests I am using this data with the schema, but I get the following Java exception:
{code:java}
org.apache.avro.AvroRuntimeException: Not a union: {"type":"record","name":"sampleArrayRecord","namespace":"gamesys.sample","fields":[{"name":"sampleArrayRecordString","type":"string"}]}
{code}
I have attached the schema and the data I've used, and the relevant stacktrace is given below:
{code:java}
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Not a union: {"type":"record","name":"sampleArrayRecord","namespace":"gamesys.sample","fields":[{"name":"sampleArrayRecordString","type":"string"}]} (through reference chain: com.google.api.services.bigquery.model.TableRow["sampleArray"]->org.apache.avro.generic.GenericData$Array[0]->org.apache.avro.generic.GenericData$Record["schema"]->org.apache.avro.Schema$RecordSchema["types"])
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:388)
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:348)
at com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:343)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:697)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:704)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:689)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155)
at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serializeContents(CollectionSerializer.java:149)
at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serialize(CollectionSerializer.java:112)
at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serialize(CollectionSerializer.java:25)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields(MapSerializer.java:633)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:536)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:30)
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:292)
at com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:3697)
at com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:3073)
at org.apache.beam.sdk.io.gcp.bigquery.TableRowJsonCoder.encode(TableRowJsonCoder.java:49)
at org.apache.beam.sdk.io.gcp.bigquery.TableRowJsonCoder.encode(TableRowJsonCoder.java:34)
at org.apache.beam.sdk.util.CoderUtils.encodeToSafeStream(CoderUtils.java:93)
... 22 more
Caused by: org.apache.avro.AvroRuntimeException: Not a union: {"type":"record","name":"sampleArrayRecord","namespace":"gamesys.sample","fields":[{"name":"sampleArrayRecordString","type":"string"}]}
at org.apache.avro.Schema.getTypes(Schema.java:299)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:664)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:689)
... 38 more
{code}
I am using the org.apache.avro:avro:1.8.1 library in the project.
was:
I have an Avro schema which I am using as part of our Apache Beam pipeline tests, and using the avro-tools-1.8.2 tool I have generated random data from the Avro schema. In the tests I am using this data with the schema, but I get the following Java exception:
{code:java}
org.apache.avro.AvroRuntimeException: Not a union: {"type":"record","name":"sampleArrayRecord","namespace":"gamesys.sample","fields":[{"name":"sampleArrayRecordString","type":"string"}]}
{code}
I have attached the schema and the data I've used, and the relevant stacktrace is given below:
{code:java}
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Not a union: {"type":"record","name":"sampleArrayRecord","namespace":"gamesys.sample","fields":[{"name":"sampleArrayRecordString","type":"string"}]} (through reference chain: com.google.api.services.bigquery.model.TableRow["sampleArray"]->org.apache.avro.generic.GenericData$Array[0]->org.apache.avro.generic.GenericData$Record["schema"]->org.apache.avro.Schema$RecordSchema["types"])
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:388)
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:348)
at com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:343)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:697)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:704)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:689)
at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155)
at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serializeContents(CollectionSerializer.java:149)
at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serialize(CollectionSerializer.java:112)
at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serialize(CollectionSerializer.java:25)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields(MapSerializer.java:633)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:536)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:30)
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:292)
at com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:3697)
at com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:3073)
at org.apache.beam.sdk.io.gcp.bigquery.TableRowJsonCoder.encode(TableRowJsonCoder.java:49)
at org.apache.beam.sdk.io.gcp.bigquery.TableRowJsonCoder.encode(TableRowJsonCoder.java:34)
at org.apache.beam.sdk.util.CoderUtils.encodeToSafeStream(CoderUtils.java:93)
... 22 more
Caused by: org.apache.avro.AvroRuntimeException: Not a union: {"type":"record","name":"sampleArrayRecord","namespace":"gamesys.sample","fields":[{"name":"sampleArrayRecordString","type":"string"}]}
at org.apache.avro.Schema.getTypes(Schema.java:299)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:664)
at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:689)
... 38 more
{code}
> AvroRuntimeException: Not a union
> ---------------------------------
>
> Key: AVRO-2125
> URL: https://issues.apache.org/jira/browse/AVRO-2125
> Project: Avro
> Issue Type: Bug
> Reporter: Andreas Christodoulou
> Attachments: all-types-schema.avsc, data.json
>
>
> I have an Avro schema which I am using as part of our Apache Beam pipeline tests, and using the avro-tools-1.8.2 tool I have generated random data from the Avro schema. In the tests I am using this data with the schema, but I get the following Java exception:
> {code:java}
> org.apache.avro.AvroRuntimeException: Not a union: {"type":"record","name":"sampleArrayRecord","namespace":"gamesys.sample","fields":[{"name":"sampleArrayRecordString","type":"string"}]}
> {code}
> I have attached the schema and the data I've used, and the relevant stacktrace is given below:
> {code:java}
> Caused by: com.fasterxml.jackson.databind.JsonMappingException: Not a union: {"type":"record","name":"sampleArrayRecord","namespace":"gamesys.sample","fields":[{"name":"sampleArrayRecordString","type":"string"}]} (through reference chain: com.google.api.services.bigquery.model.TableRow["sampleArray"]->org.apache.avro.generic.GenericData$Array[0]->org.apache.avro.generic.GenericData$Record["schema"]->org.apache.avro.Schema$RecordSchema["types"])
> at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:388)
> at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:348)
> at com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:343)
> at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:697)
> at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155)
> at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:704)
> at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:689)
> at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155)
> at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serializeContents(CollectionSerializer.java:149)
> at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serialize(CollectionSerializer.java:112)
> at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serialize(CollectionSerializer.java:25)
> at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields(MapSerializer.java:633)
> at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:536)
> at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:30)
> at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:292)
> at com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:3697)
> at com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:3073)
> at org.apache.beam.sdk.io.gcp.bigquery.TableRowJsonCoder.encode(TableRowJsonCoder.java:49)
> at org.apache.beam.sdk.io.gcp.bigquery.TableRowJsonCoder.encode(TableRowJsonCoder.java:34)
> at org.apache.beam.sdk.util.CoderUtils.encodeToSafeStream(CoderUtils.java:93)
> ... 22 more
> Caused by: org.apache.avro.AvroRuntimeException: Not a union: {"type":"record","name":"sampleArrayRecord","namespace":"gamesys.sample","fields":[{"name":"sampleArrayRecordString","type":"string"}]}
> at org.apache.avro.Schema.getTypes(Schema.java:299)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:664)
> at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:689)
> ... 38 more
> {code}
> I am using the org.apache.avro:avro:1.8.1 library in the project.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)