Package dev.vortex.jni
Class JNIArray
java.lang.Object
dev.vortex.jni.JNIArray
- All Implemented Interfaces:
Array
,AutoCloseable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
org.apache.arrow.vector.VectorSchemaRoot
exportToArrow
(org.apache.arrow.memory.BufferAllocator allocator, org.apache.arrow.vector.VectorSchemaRoot reuse) Export to an ArrowVector.getBigDecimal
(int index) Returns the BigDecimal value at the given index.byte[]
getBinary
(int index) Returns the binary value at the given index as a byte array.boolean
getBool
(int index) Returns the boolean value at the given index.byte
getByte
(int index) Returns the byte value at the given index.Returns the data type of this array.double
getDouble
(int index) Returns the double value at the given index.getField
(int index) Returns a child array at the given field index.float
getFloat
(int index) Returns the float value at the given index.int
getInt
(int index) Returns the int value at the given index.long
getLen()
Returns the number of elements in this array.long
getLong
(int index) Returns the long value at the given index.boolean
getNull
(int index) Returns true if the value at the given index is null.int
Returns the total number of null values in this array.short
getShort
(int index) Returns the short value at the given index.getUTF8
(int index) Returns the UTF-8 string value at the given index.void
getUTF8_ptr_len
(int index, long[] ptr, int[] len) Returns the UTF-8 string value at the given index as a pointer and length.long
nbytes()
Returns the total size in bytes of this array including all buffers.slice
(int start, int stop) Returns a slice of this array from start (inclusive) to stop (exclusive).
-
Constructor Details
-
JNIArray
public JNIArray(long pointer)
-
-
Method Details
-
getLen
public long getLen()Description copied from interface:Array
Returns the number of elements in this array. -
nbytes
public long nbytes()Description copied from interface:Array
Returns the total size in bytes of this array including all buffers. -
exportToArrow
public org.apache.arrow.vector.VectorSchemaRoot exportToArrow(org.apache.arrow.memory.BufferAllocator allocator, org.apache.arrow.vector.VectorSchemaRoot reuse) Description copied from interface:Array
Export to an ArrowVector. The data will now be owned by the VectorSchemaRoot after this operation.- Specified by:
exportToArrow
in interfaceArray
-
getDataType
Description copied from interface:Array
Returns the data type of this array.- Specified by:
getDataType
in interfaceArray
- Returns:
- the DType describing the logical type of this array
-
getField
Description copied from interface:Array
Returns a child array at the given field index.This is used for accessing fields in struct arrays or elements in list arrays.
-
slice
Description copied from interface:Array
Returns a slice of this array from start (inclusive) to stop (exclusive). -
getNull
public boolean getNull(int index) Description copied from interface:Array
Returns true if the value at the given index is null. -
getNullCount
public int getNullCount()Description copied from interface:Array
Returns the total number of null values in this array.- Specified by:
getNullCount
in interfaceArray
- Returns:
- the null count
-
getByte
public byte getByte(int index) Description copied from interface:Array
Returns the byte value at the given index. -
getShort
public short getShort(int index) Description copied from interface:Array
Returns the short value at the given index. -
getInt
public int getInt(int index) Description copied from interface:Array
Returns the int value at the given index. -
getLong
public long getLong(int index) Description copied from interface:Array
Returns the long value at the given index. -
getBool
public boolean getBool(int index) Description copied from interface:Array
Returns the boolean value at the given index. -
getFloat
public float getFloat(int index) Description copied from interface:Array
Returns the float value at the given index. -
getDouble
public double getDouble(int index) Description copied from interface:Array
Returns the double value at the given index. -
getBigDecimal
Description copied from interface:Array
Returns the BigDecimal value at the given index.- Specified by:
getBigDecimal
in interfaceArray
- Parameters:
index
- the element index- Returns:
- the BigDecimal value
-
getUTF8
Description copied from interface:Array
Returns the UTF-8 string value at the given index. -
getUTF8_ptr_len
public void getUTF8_ptr_len(int index, long[] ptr, int[] len) Description copied from interface:Array
Returns the UTF-8 string value at the given index as a pointer and length.This is a low-level method that provides direct access to the underlying string data without copying. The pointer and length are written to the provided arrays.
- Specified by:
getUTF8_ptr_len
in interfaceArray
- Parameters:
index
- the element indexptr
- array to store the pointer (first element will be set)len
- array to store the length (first element will be set)
-
getBinary
public byte[] getBinary(int index) Description copied from interface:Array
Returns the binary value at the given index as a byte array. -
close
public void close()- Specified by:
close
in interfaceArray
- Specified by:
close
in interfaceAutoCloseable
-