You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Gabor Szadovszky (JIRA)" <ji...@apache.org> on 2017/01/11 10:01:58 UTC

[jira] [Commented] (AVRO-1980) Write to Avro File in Bulk

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

Gabor Szadovszky commented on AVRO-1980:
----------------------------------------

DataFileWriter does not actually write record-by-record. It writes the records in blocks instead. You can read more about it at http://avro.apache.org/docs/1.8.1/spec.html#Object+Container+Files.
Or did I misunderstand your issue?

> Write to Avro File in Bulk 
> ---------------------------
>
>                 Key: AVRO-1980
>                 URL: https://issues.apache.org/jira/browse/AVRO-1980
>             Project: Avro
>          Issue Type: Improvement
>          Components: build, java
>    Affects Versions: 1.8.1
>            Reporter: Santosh Balasubramanya
>
> when writing to Avro files usually append happens record by record.
> Can't it be done by buffering and then committing it to file?
>  Below example
> DatumWriter<User> userDatumWriter = new SpecificDatumWriter<User>(User.class);
> DataFileWriter<User> dataFileWriter = new DataFileWriter<User>(userDatumWriter);
> dataFileWriter.create(user1.getSchema(), new File("users.avro"));
> dataFileWriter.append(user1);
> dataFileWriter.append(user2);
> dataFileWriter.append(user3);
> dataFileWriter.close();
>       



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)