You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Ji Liu (JIRA)" <ji...@apache.org> on 2019/07/22 03:49:00 UTC
[jira] [Updated] (ARROW-5845) [Java] Implement converter between
Arrow record batches and Avro records
[ https://issues.apache.org/jira/browse/ARROW-5845?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ji Liu updated ARROW-5845:
--------------------------
Description:
It would be useful for applications which need convert Avro data to Arrow data.
This is an adapter which convert data with existing API (like JDBC adapter) rather than a native reader (like orc).
We implement this function through Avro java project, receiving param like Decoder/Schema/DatumReader and return VectorSchemaRoot. For each data type we have a consumer class as below to get Avro data and write it into vector to avoid boxing/unboxing (e.g. GenericRecord#get returns Object)
public class AvroIntConsumer implements Consumer {
private final IntWriter writer;
public AvroIntConsumer(IntVector vector) {
this.writer = new IntWriterImpl(vector);
}
@Override
public void consume(Decoder decoder) throws IOException {
writer.writeInt(decoder.readInt());
writer.setPosition(writer.getPosition() + 1);
}
> [Java] Implement converter between Arrow record batches and Avro records
> ------------------------------------------------------------------------
>
> Key: ARROW-5845
> URL: https://issues.apache.org/jira/browse/ARROW-5845
> Project: Apache Arrow
> Issue Type: New Feature
> Components: Java
> Reporter: Ji Liu
> Assignee: Ji Liu
> Priority: Minor
>
> It would be useful for applications which need convert Avro data to Arrow data.
> This is an adapter which convert data with existing API (like JDBC adapter) rather than a native reader (like orc).
> We implement this function through Avro java project, receiving param like Decoder/Schema/DatumReader and return VectorSchemaRoot. For each data type we have a consumer class as below to get Avro data and write it into vector to avoid boxing/unboxing (e.g. GenericRecord#get returns Object)
> public class AvroIntConsumer implements Consumer {
> private final IntWriter writer;
> public AvroIntConsumer(IntVector vector) {
> this.writer = new IntWriterImpl(vector);
> }
> @Override
> public void consume(Decoder decoder) throws IOException {
> writer.writeInt(decoder.readInt());
> writer.setPosition(writer.getPosition() + 1);
> }
>
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)