Class JNIArray

java.lang.Object
dev.vortex.jni.JNIArray
All Implemented Interfaces:
Array, AutoCloseable

public final class JNIArray extends Object implements Array
  • Constructor Summary

    Constructors
    Constructor
    Description
    JNIArray(long pointer)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    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
    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
    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).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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.
      Specified by:
      getLen in interface Array
      Returns:
      the length of the array
    • nbytes

      public long nbytes()
      Description copied from interface: Array
      Returns the total size in bytes of this array including all buffers.
      Specified by:
      nbytes in interface Array
      Returns:
      the size in bytes
    • 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 interface Array
    • getDataType

      public DType getDataType()
      Description copied from interface: Array
      Returns the data type of this array.
      Specified by:
      getDataType in interface Array
      Returns:
      the DType describing the logical type of this array
    • getField

      public Array getField(int index)
      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.

      Specified by:
      getField in interface Array
      Parameters:
      index - the field index
      Returns:
      the child array at the specified index
    • slice

      public Array slice(int start, int stop)
      Description copied from interface: Array
      Returns a slice of this array from start (inclusive) to stop (exclusive).
      Specified by:
      slice in interface Array
      Parameters:
      start - the starting index (inclusive)
      stop - the ending index (exclusive)
      Returns:
      a new Array containing the sliced elements
    • getNull

      public boolean getNull(int index)
      Description copied from interface: Array
      Returns true if the value at the given index is null.
      Specified by:
      getNull in interface Array
      Parameters:
      index - the element index
      Returns:
      true if the value is null, false otherwise
    • getNullCount

      public int getNullCount()
      Description copied from interface: Array
      Returns the total number of null values in this array.
      Specified by:
      getNullCount in interface Array
      Returns:
      the null count
    • getByte

      public byte getByte(int index)
      Description copied from interface: Array
      Returns the byte value at the given index.
      Specified by:
      getByte in interface Array
      Parameters:
      index - the element index
      Returns:
      the byte value
    • getShort

      public short getShort(int index)
      Description copied from interface: Array
      Returns the short value at the given index.
      Specified by:
      getShort in interface Array
      Parameters:
      index - the element index
      Returns:
      the short value
    • getInt

      public int getInt(int index)
      Description copied from interface: Array
      Returns the int value at the given index.
      Specified by:
      getInt in interface Array
      Parameters:
      index - the element index
      Returns:
      the int value
    • getLong

      public long getLong(int index)
      Description copied from interface: Array
      Returns the long value at the given index.
      Specified by:
      getLong in interface Array
      Parameters:
      index - the element index
      Returns:
      the long value
    • getBool

      public boolean getBool(int index)
      Description copied from interface: Array
      Returns the boolean value at the given index.
      Specified by:
      getBool in interface Array
      Parameters:
      index - the element index
      Returns:
      the boolean value
    • getFloat

      public float getFloat(int index)
      Description copied from interface: Array
      Returns the float value at the given index.
      Specified by:
      getFloat in interface Array
      Parameters:
      index - the element index
      Returns:
      the float value
    • getDouble

      public double getDouble(int index)
      Description copied from interface: Array
      Returns the double value at the given index.
      Specified by:
      getDouble in interface Array
      Parameters:
      index - the element index
      Returns:
      the double value
    • getBigDecimal

      public BigDecimal getBigDecimal(int index)
      Description copied from interface: Array
      Returns the BigDecimal value at the given index.
      Specified by:
      getBigDecimal in interface Array
      Parameters:
      index - the element index
      Returns:
      the BigDecimal value
    • getUTF8

      public String getUTF8(int index)
      Description copied from interface: Array
      Returns the UTF-8 string value at the given index.
      Specified by:
      getUTF8 in interface Array
      Parameters:
      index - the element index
      Returns:
      the string value
    • 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 interface Array
      Parameters:
      index - the element index
      ptr - 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.
      Specified by:
      getBinary in interface Array
      Parameters:
      index - the element index
      Returns:
      the binary value as a byte array
    • close

      public void close()
      Specified by:
      close in interface Array
      Specified by:
      close in interface AutoCloseable