Class VortexWriter
- All Implemented Interfaces:
AutoCloseable
Open one with builder(Session, String, Schema, BufferAllocator) to write to a URI, or
builder(Session, NativeWritable, Schema, BufferAllocator) to write into a caller-provided byte sink.
Batches are accepted via the Arrow C Data Interface: callers export an Arrow record batch to an ArrowArray
/ ArrowSchema pair and pass the addresses to writeBatch(long, long). The writer accepts up to four
in-flight batches on the session's runtime thread before back-pressuring the caller.
Call close() to flush remaining batches and finalize the file. If the writer becomes unreachable without
an explicit close(), VortexCleaner will flush and release native resources as a backstop — but
callers should always finalize explicitly so that I/O errors surface through the normal call path.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionlongReturn the number of uncompressed bytes accepted by the writer but not yet written to the sink.static VortexWriter.Builderbuilder(Session session, NativeWritable writable, org.apache.arrow.vector.types.pojo.Schema arrowSchema, org.apache.arrow.memory.BufferAllocator allocator) Start configuring a writer that streams the file into a caller-provided byte sink instead of a native storage client.static VortexWriter.Builderbuilder(Session session, String uri, org.apache.arrow.vector.types.pojo.Schema arrowSchema, org.apache.arrow.memory.BufferAllocator allocator) Start configuring a writer that streams records into the file aturithrough a native storage client.longReturn the number of bytes successfully written to the underlying sink so far.voidclose()Flush any pending batches and finalize the file.finish()Flush pending batches, finalize the file, and return its statistics and physical sizes.voidwriteBatch(long arrowArrayAddr, long arrowSchemaAddr) Write a batch directly from Arrow C Data Interface addresses.
-
Method Details
-
builder
public static VortexWriter.Builder builder(Session session, String uri, org.apache.arrow.vector.types.pojo.Schema arrowSchema, org.apache.arrow.memory.BufferAllocator allocator) Start configuring a writer that streams records into the file aturithrough a native storage client. The path may be a full URI or a plain local filesystem path.- Parameters:
arrowSchema- describes the exact layout of every batch written
-
builder
public static VortexWriter.Builder builder(Session session, NativeWritable writable, org.apache.arrow.vector.types.pojo.Schema arrowSchema, org.apache.arrow.memory.BufferAllocator allocator) Start configuring a writer that streams the file into a caller-provided byte sink instead of a native storage client. This is the integration point for external I/O abstractions (for example Iceberg'sPositionOutputStream).The native side writes and flushes the sink but never closes it: after
close()returns, all bytes have been written and flushed, and the caller must close the sink to finalize the file.- Parameters:
arrowSchema- describes the exact layout of every batch written
-
writeBatch
Write a batch directly from Arrow C Data Interface addresses.- Throws:
IOException
-
bytesWritten
public long bytesWritten()Return the number of bytes successfully written to the underlying sink so far.This count does not include queued batches or data still buffered by layout strategies, so it may lag the amount of input accepted by
writeBatch(long, long). Afterfinish(), it is the exact completed file size and is equal toVortexWriteSummary.fileSize(). -
bufferedBytes
public long bufferedBytes()Return the number of uncompressed bytes accepted by the writer but not yet written to the sink.Together with
bytesWritten(), this lets callers estimate the in-progress file size: bytes that reached the sink are already compressed, while buffered bytes are still uncompressed and will shrink by roughly the file's observed compression ratio once flushed. Afterfinish(), this is zero. -
finish
Flush pending batches, finalize the file, and return its statistics and physical sizes.This method is idempotent. Later calls return the same immutable summary.
- Throws:
IOException
-
close
Flush any pending batches and finalize the file. Idempotent.- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-