Class NativeWriter

java.lang.Object
dev.vortex.jni.NativeWriter

public final class NativeWriter extends Object
JNI boundary for VortexWriter.
  • Method Summary

    Modifier and Type
    Method
    Description
    static long
    bufferedBytes(long writerPointer)
    Number of compressed bytes that the native writer holds and that have not yet reached the sink.
    static long
    bytesWritten(long writerPointer)
    Number of bytes successfully written to the underlying sink so far.
    static void
    close(long writerPointer)
    Flush and close the writer.
    static double
    compressionRatio(long writerPointer)
    Compressed bytes divided by uncompressed bytes over the data that the writer compressed so far.
    static long
    create(long sessionPointer, String uri, long arrowSchemaAddress, Map<String,String> options, Map<String,byte[]> metadata, boolean compact)
    Open a writer at uri that accepts batches matching the Arrow schema at arrowSchemaAddress.
    static long
    createStream(long sessionPointer, Object writable, long arrowSchemaAddress, Map<String,byte[]> metadata, boolean compact)
    Open a writer that streams the file into a caller-provided NativeWritable.
    static long
    estimatedSize(long writerPointer)
    Estimated size of the file if the write finished now, without the footer.
    finish(long writerPointer, Map<String,byte[]> metadata)
    Flush and close the writer, returning its completed-file summary.
    static boolean
    writeArray(long writerPointer, long arrowArrayAddress)
    Write a batch from an Arrow C Data Interface array that agrees with the writer schema.
    static boolean
    writeBatch(long writerPointer, long arrowArrayAddress, long arrowSchemaAddress)
    Write a batch directly from Arrow C Data Interface addresses.
    static boolean
    writeBatchBuffers(long writerPointer, long arrowArrayAddress, NativeBuffers buffers)
    Import a Java batch with independently retained buffer allocations.

    Methods inherited from class java.lang.Object

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

    • create

      public static long create(long sessionPointer, String uri, long arrowSchemaAddress, Map<String,String> options, Map<String,byte[]> metadata, boolean compact)
      Open a writer at uri that accepts batches matching the Arrow schema at arrowSchemaAddress.
      Parameters:
      metadata - user-defined metadata segments to store in the file footer (may be null)
      compact - write with the compact strategy, which prefers a smaller file over read throughput
    • createStream

      public static long createStream(long sessionPointer, Object writable, long arrowSchemaAddress, Map<String,byte[]> metadata, boolean compact)
      Open a writer that streams the file into a caller-provided NativeWritable. The native side writes and flushes but never closes the writable; the caller must close it after close(long).
      Parameters:
      metadata - user-defined metadata segments to store in the file footer (may be null)
      compact - write with the compact strategy, which prefers a smaller file over read throughput
    • writeBatch

      public static boolean writeBatch(long writerPointer, long arrowArrayAddress, long arrowSchemaAddress)
      Write a batch directly from Arrow C Data Interface addresses.
      Parameters:
      writerPointer - pointer from create(long, java.lang.String, long, java.util.Map<java.lang.String, java.lang.String>, java.util.Map<java.lang.String, byte[]>, boolean)
      arrowArrayAddress - address of an ArrowArray struct
      arrowSchemaAddress - address of an ArrowSchema struct
      Returns:
      true on success
    • writeArray

      public static boolean writeArray(long writerPointer, long arrowArrayAddress)
      Write a batch from an Arrow C Data Interface array that agrees with the writer schema. Native code takes the array and releases it, also when the call fails.
      Returns:
      true on success
    • writeBatchBuffers

      public static boolean writeBatchBuffers(long writerPointer, long arrowArrayAddress, NativeBuffers buffers)
      Import a Java batch with independently retained buffer allocations. The exported array must match the schema passed to create(long, java.lang.String, long, java.util.Map<java.lang.String, java.lang.String>, java.util.Map<java.lang.String, byte[]>, boolean); the caller must serialize writes and close. Buffer metadata is single-use.
    • bytesWritten

      public static long bytesWritten(long writerPointer)
      Number of bytes successfully written to the underlying sink so far.
    • bufferedBytes

      public static long bufferedBytes(long writerPointer)
      Number of compressed bytes that the native writer holds and that have not yet reached the sink.
    • estimatedSize

      public static long estimatedSize(long writerPointer)
      Estimated size of the file if the write finished now, without the footer.
    • compressionRatio

      public static double compressionRatio(long writerPointer)
      Compressed bytes divided by uncompressed bytes over the data that the writer compressed so far.
    • close

      public static void close(long writerPointer)
      Flush and close the writer. Must be called exactly once.
    • finish

      public static VortexWriteSummary finish(long writerPointer, Map<String,byte[]> metadata)
      Flush and close the writer, returning its completed-file summary. Must be called exactly once.
      Parameters:
      metadata - metadata segments to merge with the create-time segments (may be null)