avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ratha v <vijayara...@gmail.com>
Subject How to define byte[] and LocalDateTime in avro schema?
Date Thu, 14 Apr 2016 05:39:21 GMT
Hi all;
Im new to Avro schema. I try to publish/consumer my java objects using
kafka.

I have java bean classes, which contains fields with LocalDateTime and
byte[] . How can I define both in avro schema primitive types?What is the
best primitive type i can use for LocalDateTime?

private LocalDateTime timestamp;
private byte[] content;

I defined something like this; but getting



* {            "name": "content", "type": "bytes"    },*

Class cast exception[1]

[1]
Caused by: java.lang.ClassCastException: [B cannot be cast to
java.nio.ByteBuffer at
org.apache.avro.generic.GenericDatumWriter.writeBytes(GenericDatumWriter.java:219)
at
org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:77)
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)


--
-Ratha
http://vvratha.blogspot.com/

Mime
View raw message