java.lang.Object
org.apache.arrow.vector.ipc.ArrowWriter
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
ArrowFileWriter,ArrowStreamWriter
Abstract base class for implementing Arrow writers for IPC over a WriteChannel.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedArrowWriter(VectorSchemaRoot root, DictionaryProvider provider, WritableByteChannel out) protectedArrowWriter(VectorSchemaRoot root, DictionaryProvider provider, WritableByteChannel out, IpcOption option) protectedArrowWriter(VectorSchemaRoot root, DictionaryProvider provider, WritableByteChannel out, IpcOption option, CompressionCodec.Factory compressionFactory, CompressionUtil.CodecType codecType, Optional<Integer> compressionLevel) Note: fields are not closed when the writer is closed. -
Method Summary
Modifier and TypeMethodDescriptionlongvoidclose()voidend()protected voidendInternal(WriteChannel out) protected abstract 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).voidstart()protected voidvoidWrites the record batch currently loaded in this instance's VectorSchemaRoot.protected voidwriteDictionaryBatch(Dictionary dictionary) protected ArrowBlockprotected ArrowBlockwriteRecordBatch(ArrowRecordBatch batch)
-
Field Details
-
LOGGER
protected static final org.slf4j.Logger LOGGER -
schema
-
out
-
option
-
-
Constructor Details
-
ArrowWriter
-
ArrowWriter
protected ArrowWriter(VectorSchemaRoot root, DictionaryProvider provider, WritableByteChannel out, IpcOption option) -
ArrowWriter
protected ArrowWriter(VectorSchemaRoot root, DictionaryProvider provider, WritableByteChannel out, IpcOption option, CompressionCodec.Factory compressionFactory, CompressionUtil.CodecType codecType, Optional<Integer> compressionLevel) Note: fields are not closed when the writer is closed.- Parameters:
root- the vectors to write to the outputprovider- where to find the dictionariesout- the output where to writeoption- IPC write optionscompressionFactory- Compression codec factorycodecType- Compression codeccompressionLevel- Compression level
-
-
Method Details
-
start
- Throws:
IOException
-
writeBatch
Writes the record batch currently loaded in this instance's VectorSchemaRoot.- Throws:
IOException
-
writeDictionaryBatch
- Throws:
IOException
-
writeDictionaryBatch
- Throws:
IOException
-
writeRecordBatch
- Throws:
IOException
-
end
- Throws:
IOException
-
bytesWritten
public long bytesWritten() -
ensureDictionariesWritten
protected abstract void ensureDictionariesWritten(DictionaryProvider provider, Set<Long> dictionaryIdsUsed) throws IOException Write dictionaries after schema and before recordBatches, dictionaries won't be written if empty stream (only has schema data in IPC).- Throws:
IOException
-
startInternal
- Throws:
IOException
-
endInternal
- Throws:
IOException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-