Class VortexWriter

java.lang.Object
dev.vortex.api.VortexWriter
All Implemented Interfaces:
AutoCloseable

public final class VortexWriter extends Object implements AutoCloseable
Writer for Vortex files.

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.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Flush any pending batches and finalize the file.
    create(Session session, String uri, org.apache.arrow.vector.types.pojo.Schema arrowSchema, Map<String,String> options, org.apache.arrow.memory.BufferAllocator allocator)
    Create a writer that streams records into the file at uri.
    void
    writeBatch(long arrowArrayAddr, long arrowSchemaAddr)
    Write a batch directly from Arrow C Data Interface addresses.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • create

      public static VortexWriter create(Session session, String uri, org.apache.arrow.vector.types.pojo.Schema arrowSchema, Map<String,String> options, org.apache.arrow.memory.BufferAllocator allocator) throws IOException
      Create a writer that streams records into the file at uri. The path may be a full URI or a plain local filesystem path. The Arrow schema describes the exact layout of every batch written.
      Throws:
      IOException
    • writeBatch

      public void writeBatch(long arrowArrayAddr, long arrowSchemaAddr) throws IOException
      Write a batch directly from Arrow C Data Interface addresses.
      Throws:
      IOException
    • close

      public void close() throws IOException
      Flush any pending batches and finalize the file. Idempotent.
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException