Package dev.vortex.jni
Class NativeWriter
java.lang.Object
dev.vortex.jni.NativeWriter
JNI boundary for
VortexWriter.-
Method Summary
Modifier and TypeMethodDescriptionstatic longbufferedBytes(long writerPointer) Number of compressed bytes that the native writer holds and that have not yet reached the sink.static longbytesWritten(long writerPointer) Number of bytes successfully written to the underlying sink so far.static voidclose(long writerPointer) Flush and close the writer.static doublecompressionRatio(long writerPointer) Compressed bytes divided by uncompressed bytes over the data that the writer compressed so far.static longcreate(long sessionPointer, String uri, long arrowSchemaAddress, Map<String, String> options, Map<String, byte[]> metadata, boolean compact) Open a writer aturithat accepts batches matching the Arrow schema atarrowSchemaAddress.static longcreateStream(long sessionPointer, Object writable, long arrowSchemaAddress, Map<String, byte[]> metadata, boolean compact) Open a writer that streams the file into a caller-providedNativeWritable.static longestimatedSize(long writerPointer) Estimated size of the file if the write finished now, without the footer.static VortexWriteSummaryFlush and close the writer, returning its completed-file summary.static booleanwriteArray(long writerPointer, long arrowArrayAddress) Write a batch from an Arrow C Data Interface array that agrees with the writer schema.static booleanwriteBatch(long writerPointer, long arrowArrayAddress, long arrowSchemaAddress) Write a batch directly from Arrow C Data Interface addresses.static booleanwriteBatchBuffers(long writerPointer, long arrowArrayAddress, NativeBuffers buffers) Import a Java batch with independently retained buffer allocations.
-
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 aturithat accepts batches matching the Arrow schema atarrowSchemaAddress.- 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-providedNativeWritable. The native side writes and flushes but never closes the writable; the caller must close it afterclose(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 fromcreate(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 anArrowArraystructarrowSchemaAddress- address of anArrowSchemastruct- Returns:
trueon 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:
trueon 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 tocreate(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
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)
-