Class HostColumnVectorCore

java.lang.Object
ai.rapids.cudf.HostColumnVectorCore
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
HostColumnVector

public class HostColumnVectorCore extends Object implements AutoCloseable
A class that holds Host side Column Vector APIs and the OffHeapState. Any children of a HostColumnVector will be instantiated via this class.
  • Field Details

  • Constructor Details

  • Method Details

    • getType

      public DType getType()
      Returns the type of this vector.
    • getData

      public HostMemoryBuffer getData()
      Returns the data buffer for a given host side column vector
    • getValidity

      public HostMemoryBuffer getValidity()
      Returns the validity buffer for a given host side column vector
    • getOffsets

      public HostMemoryBuffer getOffsets()
      Returns the offset buffer
    • getChildColumnView

      public HostColumnVectorCore getChildColumnView(int childIndex)
    • getNullCount

      public long getNullCount()
      Returns the number of nulls in the data. Note that this might end up being a very expensive operation because if the null count is not known it will be calculated.
    • getRowCount

      public long getRowCount()
      Returns the number of rows for a given host side column vector
    • getNumChildren

      public int getNumChildren()
      Returns the number of children for this column
    • getHostBufferFor

      public HostMemoryBuffer getHostBufferFor(BufferType type)
      Get access to the raw host buffer for this column. This is intended to be used with a lot of caution. The lifetime of the buffer is tied to the lifetime of the column (Do not close the buffer, as the column will take care of it). Do not modify the contents of the buffer or it might negatively impact what happens on the column. The data must be on the host for this to work.
      Parameters:
      type - the type of buffer to get access to.
      Returns:
      the underlying buffer or null if no buffer is associated with it for this column. Please note that if the column is empty there may be no buffers at all associated with the column.
    • getByte

      public byte getByte(long index)
      Get the value at index.
    • getShort

      public final short getShort(long index)
      Get the value at index.
    • getInt

      public final int getInt(long index)
      Get the value at index.
    • getStartListOffset

      public long getStartListOffset(long index)
      Get the starting element offset for the list or string at index
    • getEndListOffset

      public long getEndListOffset(long index)
      Get the ending element offset for the list or string at index.
    • getLong

      public final long getLong(long index)
      Get the value at index.
    • getFloat

      public final float getFloat(long index)
      Get the value at index.
    • getDouble

      public final double getDouble(long index)
      Get the value at index.
    • getBoolean

      public final boolean getBoolean(long index)
      Get the boolean value at index
    • getBigDecimal

      public final BigDecimal getBigDecimal(long index)
      Get the BigDecimal value at index.
    • getUTF8

      public byte[] getUTF8(long index)
      Get the raw UTF8 bytes at index. This API is faster than getJavaString, but still not ideal because it is copying the data onto the heap.
    • getJavaString

      public String getJavaString(long index)
      Get the value at index. This API is slow as it has to translate the string representation. Please use it with caution.
    • getBytesFromList

      public byte[] getBytesFromList(long rowIndex)
      WARNING: Special case for lists of int8 or uint8, does not support null list values or lists Get array of bytes at index from a list column of int8 or uint8. The column may not be a list of lists and may not have nulls.
    • getList

      public List getList(long rowIndex)
      WARNING: Strictly for test only. This call is not efficient for production.
    • getStruct

      public HostColumnVector.StructData getStruct(int rowIndex)
      WARNING: Strictly for test only. This call is not efficient for production.
    • isNull

      public boolean isNull(long rowIndex)
      Method that returns a boolean to indicate if the element at a given row index is null
      Parameters:
      rowIndex - the row index
      Returns:
      true if null else false
    • hasValidityVector

      public boolean hasValidityVector()
      Returns if the vector has a validity vector allocated or not.
    • hasNulls

      public boolean hasNulls()
      Returns if the vector has nulls. Note that this might end up being a very expensive operation because if the null count is not known it will be calculated.
    • getHostMemorySize

      public long getHostMemorySize()
      Returns the amount of host memory used to store column/validity data (not metadata).
    • close

      public void close()
      Close method for the column
      Specified by:
      close in interface AutoCloseable
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • convertDecimal128FromJavaToCudf

      protected static byte[] convertDecimal128FromJavaToCudf(byte[] bytes)