[
https://issues.apache.org/jira/browse/AVRO-2588?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16947944#comment-16947944
]
Richard N. Hillegas commented on AVRO-2588:
-------------------------------------------
I have attached avroByteSerialization.tar, a program which demonstrates this
problem. Here are the contents of the README file in this tarball:
This sample program demonstrates that fields typed as "bytes" are NOT
serialized when using a DatumWriter. However, they are serialized correctly
when you hand-write them via a BinaryEncoder.
1) After unpacking the tarball, cd to the root of the unpacked directory tree.
2) Then issue the following command
mvn install
3) Then issue the following command
mvn exec:java
This will produce the following output:
Result of serializing from an object: {"tag": "Sample row", "bigintCol":
12345678901234, "binaryCol": "", "booleanCol": false}
Result of hand-serializing the fields: {"tag": "Sample row 2", "bigintCol":
12345678901235, "binaryCol": "\u000F\u000E\r", "booleanCol": true}
As you can see, the binaryCol field is empty when using the first approach but
has the correct data when using the second approach.
> DatumWriter does not serialize bytes-typed fields
> -------------------------------------------------
>
> Key: AVRO-2588
> URL: https://issues.apache.org/jira/browse/AVRO-2588
> Project: Apache Avro
> Issue Type: Bug
> Components: java
> Affects Versions: 1.9.1
> Reporter: Richard N. Hillegas
> Priority: Major
> Attachments: avroByteSerialization.tar
>
>
> When you use a DatumWriter to serialize a record, fields of "bytes" type are
> NOT serialized. You have to hand-serialize these fields using
> BinaryEncoder.writeBytes().
> I will attach a sample program which demonstrates this problem.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)