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
-
Constructor Summary
ModifierConstructorDescriptionprotected
ArrowWriter
(VectorSchemaRoot root, DictionaryProvider provider, WritableByteChannel out) protected
ArrowWriter
(VectorSchemaRoot root, DictionaryProvider provider, WritableByteChannel out, IpcOption option) 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. -
Method Summary
Modifier and TypeMethodDescriptionlong
void
close()
void
end()
protected void
endInternal
(WriteChannel out) protected abstract void
ensureDictionariesWritten
(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).void
start()
protected void
void
Writes the record batch currently loaded in this instance's VectorSchemaRoot.protected void
writeDictionaryBatch
(Dictionary dictionary) protected ArrowBlock
protected ArrowBlock
writeRecordBatch
(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:
close
in interfaceAutoCloseable
-