[ 
https://issues.apache.org/jira/browse/AVRO-2487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16975644#comment-16975644
 ] 

Zezeng Wang commented on AVRO-2487:
-----------------------------------

In versions 1.9.0 and 1.8.2, I use the shcema you provided, and there is no 
byte serialized to an empty string. It may be that my verification method is 
different from yours. You can compare it with smart ones.
Here is my complete shcema:
{code}
{"namespace":"example.avro",
 "type":"record",
 "name":"User",
 "fields":[{"name":"name","type":"string"},
              {"name":"data","type":"bytes"},
              {"name":"files",
               "type":
                         {"type":"map","values":"bytes"}
              }
 ]
}
{code}
And the code is the same.

> Bytes are serialized to empty string with DataFileWriter
> --------------------------------------------------------
>
>                 Key: AVRO-2487
>                 URL: https://issues.apache.org/jira/browse/AVRO-2487
>             Project: Apache Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.7.7, 1.8.0, 1.8.1, 1.9.0, 1.8.2
>            Reporter: 富恒
>            Priority: Major
>
> bytes fields are serialized to empty string with DataFileWriter.
>  
> schema:
> {
>  "name": "files",
>  "type":
> { "type": "map", "values": "bytes" }
> }
> or 
> { "name": "data", "type": "bytes" }
>  
> code:
> DatumWriter<User> userDatumWriter = new SpecificDatumWriter<>(User.class);
>  DataFileWriter<User> dataFileWriter = new DataFileWriter<>(userDatumWriter);
>  dataFileWriter.setFlushOnEveryBlock(true);
>  dataFileWriter.setSyncInterval(32);
>  dataFileWriter.create(user1.getSchema(), new File(backupFolder + 
> File.separator + ".users.avro"));
>  dataFileWriter.append(user1);
>  dataFileWriter.close();



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to