avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hong, Shunhui Welly" <Shunhui.Welly.H...@jpmorgan.com>
Subject Unknown datum type java.lang.Short Exception (AVRO 1.7.7)
Date Thu, 21 Jan 2016 16:18:24 GMT
Hi,

I got "Unknown datum type java.lang.Short" exception when I tried to encoding data.

org.apache.avro.AvroRuntimeException: Unknown datum type java.lang.Short: 1
       at org.apache.avro.generic.GenericData.getSchemaName(GenericData.java:636)
       at org.apache.avro.generic.GenericData.resolveUnion(GenericData.java:601)
       at org.apache.avro.generic.GenericDatumWriter.resolveUnion(GenericDatumWriter.java:151)
       at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:71)
       at org.apache.avro.generic.GenericDatumWriter.writeArray(GenericDatumWriter.java:138)
       at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:68)
       at org.apache.avro.generic.GenericDatumWriter.writeArray(GenericDatumWriter.java:138)
       at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:68)
       at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:73)
       at org.apache.avro.generic.GenericDatumWriter.writeField(GenericDatumWriter.java:114)
       at org.apache.avro.generic.GenericDatumWriter.writeRecord(GenericDatumWriter.java:104)
       at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:66)
       at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:58)


My schema:
{
"type": "record",
"name": "Response",
"fields":
       [
{"name":"data","type":[{"type":"array","items":{"type":"array","items":["string","int","long","float","double","boolean","null"]}},"null"]}
       ]
}

I got data from Microsoft SQL server and one of returned fields was defined as tinyint. I
believe this tinyint field caused above exception. It seems similar as https://issues.apache.org/jira/browse/AVRO-1500
. However, it didn't fix my issue above. Can I define "short" in the schema?

Please advise.

Thank you,

Welly

This email is confidential and subject to important disclaimers and conditions including on
offers for the purchase or sale of securities, accuracy and completeness of information, 
viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email

Mime
View raw message