[
https://issues.apache.org/jira/browse/AVRO-2588?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16948232#comment-16948232
]
Jacob Tolar commented on AVRO-2588:
-----------------------------------
I don't see anything broken here.
>From your example:
{code:java}
ByteBuffer binaryData = ByteBuffer.allocate(SAMPLE_BYTES.length);
binaryData.put(SAMPLE_BYTES);
MyRecord row = MyRecord.newBuilder()
.setTag("Sample row")
.setBigintCol(12345678901234L)
.setBinaryCol(binaryData)
.setBooleanCol(false)
.build()
;
// serialize the row into the outgoing byte stream
datumWriter.write(row, encoder);
encoder.flush();
output.flush();
output.getFD().sync();
output.close();
{code}
I think you forgot to {{rewind}} your ByteBuffer?
> 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)