Package ai.rapids.cudf
Class HostColumnVectorCore
java.lang.Object
ai.rapids.cudf.HostColumnVectorCore
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
HostColumnVector
A class that holds Host side Column Vector APIs and the OffHeapState.
Any children of a HostColumnVector will be instantiated via this class.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final classHolds the off heap state of the column vector so we can clean it up, even if it is leaked. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHostColumnVectorCore(DType type, long rows, Optional<Long> nullCount, HostMemoryBuffer data, HostMemoryBuffer validity, HostMemoryBuffer offsets, List<HostColumnVectorCore> nestedChildren) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close method for the columnprotected static byte[]convertDecimal128FromJavaToCudf(byte[] bytes) final BigDecimalgetBigDecimal(long index) Get the BigDecimal value at index.final booleangetBoolean(long index) Get the boolean value at indexbytegetByte(long index) Get the value at index.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.getChildColumnView(int childIndex) getData()Returns the data buffer for a given host side column vectorfinal doublegetDouble(long index) Get the value at index.longgetEndListOffset(long index) Get the ending element offset for the list or string at index.final floatgetFloat(long index) Get the value at index.getHostBufferFor(BufferType type) Get access to the raw host buffer for this column.longReturns the amount of host memory used to store column/validity data (not metadata).final intgetInt(long index) Get the value at index.getJavaString(long index) Get the value at index.getList(long rowIndex) WARNING: Strictly for test only.final longgetLong(long index) Get the value at index.longReturns the number of nulls in the data.intReturns the number of children for this columnReturns the offset bufferlongReturns the number of rows for a given host side column vectorfinal shortgetShort(long index) Get the value at index.longgetStartListOffset(long index) Get the starting element offset for the list or string at indexgetStruct(int rowIndex) WARNING: Strictly for test only.getType()Returns the type of this vector.byte[]getUTF8(long index) Get the raw UTF8 bytes at index.Returns the validity buffer for a given host side column vectorbooleanhasNulls()Returns if the vector has nulls.booleanReturns if the vector has a validity vector allocated or not.booleanisNull(long rowIndex) Method that returns a boolean to indicate if the element at a given row index is nulltoString()
-
Field Details
-
offHeap
-
type
-
rows
protected long rows -
nullCount
-
children
-
-
Constructor Details
-
HostColumnVectorCore
public HostColumnVectorCore(DType type, long rows, Optional<Long> nullCount, HostMemoryBuffer data, HostMemoryBuffer validity, HostMemoryBuffer offsets, List<HostColumnVectorCore> nestedChildren)
-
-
Method Details
-
getType
Returns the type of this vector. -
getData
Returns the data buffer for a given host side column vector -
getValidity
Returns the validity buffer for a given host side column vector -
getOffsets
Returns the offset buffer -
getChildColumnView
-
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
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
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
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
WARNING: Strictly for test only. This call is not efficient for production. -
getStruct
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:
closein interfaceAutoCloseable
-
toString
-
convertDecimal128FromJavaToCudf
protected static byte[] convertDecimal128FromJavaToCudf(byte[] bytes)
-