java.lang.Object
org.apache.arrow.vector.ipc.ArrowWriter
org.apache.arrow.vector.ipc.ArrowStreamWriter
- All Implemented Interfaces:
AutoCloseable
Writer for the Arrow stream format to send ArrowRecordBatches over a WriteChannel.
-
Field Summary
Fields inherited from class org.apache.arrow.vector.ipc.ArrowWriter
LOGGER, option, out, schema -
Constructor Summary
ConstructorsConstructorDescriptionArrowStreamWriter(VectorSchemaRoot root, DictionaryProvider provider, OutputStream out) Construct an ArrowStreamWriter with an optional DictionaryProvider for the OutputStream.ArrowStreamWriter(VectorSchemaRoot root, DictionaryProvider provider, WritableByteChannel out) Construct an ArrowStreamWriter with an optional DictionaryProvider for the WritableByteChannel.ArrowStreamWriter(VectorSchemaRoot root, DictionaryProvider provider, WritableByteChannel out, IpcOption option) Construct an ArrowStreamWriter with an optional DictionaryProvider for the WritableByteChannel.ArrowStreamWriter(VectorSchemaRoot root, DictionaryProvider provider, WritableByteChannel out, IpcOption option, CompressionCodec.Factory compressionFactory, CompressionUtil.CodecType codecType) Construct an ArrowStreamWriter with compression enabled.ArrowStreamWriter(VectorSchemaRoot root, DictionaryProvider provider, WritableByteChannel out, IpcOption option, CompressionCodec.Factory compressionFactory, CompressionUtil.CodecType codecType, Optional<Integer> compressionLevel) Construct an ArrowStreamWriter with compression enabled. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected voidendInternal(WriteChannel out) protected voidensureDictionariesWritten(DictionaryProvider provider, Set<Long> dictionaryIdsUsed) Write dictionaries after schema and before recordBatches, dictionaries won't be written if empty stream (only has schema data in IPC).static voidwriteEndOfStream(WriteChannel out, IpcOption option) Write an EOS identifier to the WriteChannel.Methods inherited from class org.apache.arrow.vector.ipc.ArrowWriter
bytesWritten, end, start, startInternal, writeBatch, writeDictionaryBatch, writeDictionaryBatch, writeRecordBatch
-
Constructor Details
-
ArrowStreamWriter
Construct an ArrowStreamWriter with an optional DictionaryProvider for the OutputStream.- Parameters:
root- Existing VectorSchemaRoot with vectors to be written.provider- DictionaryProvider for any vectors that are dictionary encoded. (Optional, can be null)out- OutputStream for writing.
-
ArrowStreamWriter
public ArrowStreamWriter(VectorSchemaRoot root, DictionaryProvider provider, WritableByteChannel out) Construct an ArrowStreamWriter with an optional DictionaryProvider for the WritableByteChannel. -
ArrowStreamWriter
public ArrowStreamWriter(VectorSchemaRoot root, DictionaryProvider provider, WritableByteChannel out, IpcOption option) Construct an ArrowStreamWriter with an optional DictionaryProvider for the WritableByteChannel.- Parameters:
root- Existing VectorSchemaRoot with vectors to be written.provider- DictionaryProvider for any vectors that are dictionary encoded. (Optional, can be null)option- IPC write optionsout- WritableByteChannel for writing.
-
ArrowStreamWriter
public ArrowStreamWriter(VectorSchemaRoot root, DictionaryProvider provider, WritableByteChannel out, IpcOption option, CompressionCodec.Factory compressionFactory, CompressionUtil.CodecType codecType) Construct an ArrowStreamWriter with compression enabled.- Parameters:
root- Existing VectorSchemaRoot with vectors to be written.provider- DictionaryProvider for any vectors that are dictionary encoded. (Optional, can be null)option- IPC write optionscompressionFactory- Compression codec factorycodecType- Codec typeout- WritableByteChannel for writing.
-
ArrowStreamWriter
public ArrowStreamWriter(VectorSchemaRoot root, DictionaryProvider provider, WritableByteChannel out, IpcOption option, CompressionCodec.Factory compressionFactory, CompressionUtil.CodecType codecType, Optional<Integer> compressionLevel) Construct an ArrowStreamWriter with compression enabled.- Parameters:
root- Existing VectorSchemaRoot with vectors to be written.provider- DictionaryProvider for any vectors that are dictionary encoded. (Optional, can be null)option- IPC write optionscompressionFactory- Compression codec factorycodecType- Codec typecompressionLevel- Compression levelout- WritableByteChannel for writing.
-
-
Method Details
-
writeEndOfStream
Write an EOS identifier to the WriteChannel.- Parameters:
out- Open WriteChannel with an active Arrow stream.option- IPC write option- Throws:
IOException- on error
-
endInternal
- Overrides:
endInternalin classArrowWriter- Throws:
IOException
-
ensureDictionariesWritten
protected void ensureDictionariesWritten(DictionaryProvider provider, Set<Long> dictionaryIdsUsed) throws IOException Description copied from class:ArrowWriterWrite dictionaries after schema and before recordBatches, dictionaries won't be written if empty stream (only has schema data in IPC).- Specified by:
ensureDictionariesWrittenin classArrowWriter- Throws:
IOException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classArrowWriter
-