Class HostColumnVector
- All Implemented Interfaces:
AutoCloseable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static final class
static final class
Buildstatic class
static interface
Interface to handle events for this HostColumnVector.static class
static class
static class
Nested classes/interfaces inherited from class ai.rapids.cudf.HostColumnVectorCore
HostColumnVectorCore.OffHeapState
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionHostColumnVector
(DType type, long rows, Optional<Long> nullCount, HostMemoryBuffer hostDataBuffer, HostMemoryBuffer hostValidityBuffer, HostMemoryBuffer offsetBuffer, List<HostColumnVectorCore> nestedHcv) Create a new column vector with data populated on the host. -
Method Summary
Modifier and TypeMethodDescriptionstatic HostColumnVector
boolFromBytes
(byte... values) Create a new vector from the given values.static HostColumnVector
build
(int rows, long stringBufferSize, Consumer<HostColumnVector.Builder> init) static HostColumnVector
build
(DType type, int rows, Consumer<HostColumnVector.Builder> init) Create a new vector.static HostColumnVector.Builder
builder
(int rows, long stringBufferSize) Create a new Builder to hold the specified number of rows and with enough space to hold the given amount of string data.static HostColumnVector.Builder
Create a new Builder to hold the specified number of rows.void
close()
Close this Vector and free memory allocated for HostMemoryBuffer and DeviceMemoryBufferCopy the data to the device.static HostColumnVector
daysFromInts
(int... values) Create a new vector from the given values.static HostColumnVector
decimalFromBigIntegers
(int scale, BigInteger... values) Create a new decimal vector from unscaled values (BigInteger array) and scale.static HostColumnVector
decimalFromBoxedInts
(int scale, Integer... values) Create a new decimal vector from boxed unscaled values (Integer array) and scale.static HostColumnVector
decimalFromBoxedLongs
(int scale, Long... values) Create a new decimal vector from boxed unscaled values (Long array) and scale.static HostColumnVector
decimalFromDoubles
(DType type, RoundingMode mode, double... values) Create a new decimal vector from double floats with specific DecimalType and RoundingMode.static HostColumnVector
decimalFromInts
(int scale, int... values) Create a new decimal vector from unscaled values (int array) and scale.static HostColumnVector
decimalFromLongs
(int scale, long... values) Create a new decimal vector from unscaled values (long array) and scale.static HostColumnVector
durationDaysFromBoxedInts
(Integer... values) Create a new vector from the given values.static HostColumnVector
durationDaysFromInts
(int... values) Create a new vector from the given values.static HostColumnVector
durationMicrosecondsFromBoxedLongs
(Long... values) Create a new vector from the given values.static HostColumnVector
durationMicrosecondsFromLongs
(long... values) Create a new vector from the given values.static HostColumnVector
durationMillisecondsFromBoxedLongs
(Long... values) Create a new vector from the given values.static HostColumnVector
durationMillisecondsFromLongs
(long... values) Create a new vector from the given values.static HostColumnVector
durationNanosecondsFromBoxedLongs
(Long... values) Create a new vector from the given values.static HostColumnVector
durationNanosecondsFromLongs
(long... values) Create a new vector from the given values.static HostColumnVector
durationSecondsFromBoxedLongs
(Long... values) Create a new vector from the given values.static HostColumnVector
durationSecondsFromLongs
(long... values) Create a new vector from the given values.static HostColumnVector
emptyStructs
(HostColumnVector.DataType dataType, long rows) static HostColumnVector
fromBoxedBooleans
(Boolean... values) Create a new vector from the given values.static HostColumnVector
fromBoxedBytes
(Byte... values) Create a new vector from the given values.static HostColumnVector
fromBoxedDoubles
(Double... values) Create a new vector from the given values.static HostColumnVector
fromBoxedFloats
(Float... values) Create a new vector from the given values.static HostColumnVector
fromBoxedInts
(Integer... values) Create a new vector from the given values.static HostColumnVector
fromBoxedLongs
(Long... values) Create a new vector from the given values.static HostColumnVector
fromBoxedShorts
(Short... values) Create a new vector from the given values.static HostColumnVector
fromBoxedUnsignedBytes
(Byte... values) Create a new vector from the given values.static HostColumnVector
fromBoxedUnsignedInts
(Integer... values) Create a new vector from the given values.static HostColumnVector
fromBoxedUnsignedLongs
(Long... values) Create a new vector from the given values.static HostColumnVector
fromBoxedUnsignedShorts
(Short... values) Create a new vector from the given values.static HostColumnVector
fromBytes
(byte... values) Create a new vector from the given values.static HostColumnVector
fromDecimals
(BigDecimal... values) Create a new vector from the given values.static HostColumnVector
fromDoubles
(double... values) Create a new vector from the given values.static HostColumnVector
fromFloats
(float... values) Create a new vector from the given values.static HostColumnVector
fromInts
(int... values) Create a new vector from the given values.static <T> HostColumnVector
fromLists
(HostColumnVector.DataType dataType, List<T>... values) static HostColumnVector
fromLongs
(long... values) Create a new vector from the given values.static HostColumnVector
fromShorts
(short... values) Create a new vector from the given values.static HostColumnVector
fromStrings
(String... values) Create a new string vector from the given values.static HostColumnVector
fromStructs
(HostColumnVector.DataType dataType, HostColumnVector.StructData... values) static HostColumnVector
fromStructs
(HostColumnVector.DataType dataType, List<HostColumnVector.StructData> values) static HostColumnVector
fromUnsignedBytes
(byte... values) Create a new vector from the given values.static HostColumnVector
fromUnsignedInts
(int... values) Create a new vector from the given values.static HostColumnVector
fromUnsignedLongs
(long... values) Create a new vector from the given values.static HostColumnVector
fromUnsignedShorts
(short... values) Create a new vector from the given values.static HostColumnVector
fromUTF8Strings
(byte[]... values) Create a new string vector from the given values.Returns the current event handler for this HostColumnVector or null if no handler is associated.int
Returns this column's current refcountIncrement the reference count for this column.void
This is a really ugly API, but it is possible that the lifecycle of a column of data may not have a clear lifecycle thanks to java and GC.setEventHandler
(HostColumnVector.EventHandler newHandler) Set an event handler for this host vector.static HostColumnVector
timestampDaysFromBoxedInts
(Integer... values) Create a new vector from the given values.static HostColumnVector
timestampMicroSecondsFromBoxedLongs
(Long... values) Create a new vector from the given values.static HostColumnVector
timestampMicroSecondsFromLongs
(long... values) Create a new vector from the given values.static HostColumnVector
timestampMilliSecondsFromBoxedLongs
(Long... values) Create a new vector from the given values.static HostColumnVector
timestampMilliSecondsFromLongs
(long... values) Create a new vector from the given values.static HostColumnVector
timestampNanoSecondsFromBoxedLongs
(Long... values) Create a new vector from the given values.static HostColumnVector
timestampNanoSecondsFromLongs
(long... values) Create a new vector from the given values.static HostColumnVector
timestampSecondsFromBoxedLongs
(Long... values) Create a new vector from the given values.static HostColumnVector
timestampSecondsFromLongs
(long... values) Create a new vector from the given values.toString()
Methods inherited from class ai.rapids.cudf.HostColumnVectorCore
convertDecimal128FromJavaToCudf, getBigDecimal, getBoolean, getByte, getBytesFromList, getChildColumnView, getData, getDouble, getEndListOffset, getFloat, getHostBufferFor, getHostMemorySize, getInt, getJavaString, getList, getLong, getNullCount, getNumChildren, getOffsets, getRowCount, getShort, getStartListOffset, getStruct, getType, getUTF8, getValidity, hasNulls, hasValidityVector, isNull
-
Constructor Details
-
HostColumnVector
public HostColumnVector(DType type, long rows, Optional<Long> nullCount, HostMemoryBuffer hostDataBuffer, HostMemoryBuffer hostValidityBuffer, HostMemoryBuffer offsetBuffer, List<HostColumnVectorCore> nestedHcv) Create a new column vector with data populated on the host.- Parameters:
type
- the type of the vectorrows
- the number of rows in the vector.nullCount
- the number of nulls in the vector.hostDataBuffer
- The host side data for the vector. In the case of STRING this is the string data stored as bytes.hostValidityBuffer
- Arrow-like validity buffer 1 bit per row, with padding for 64-bit alignment.offsetBuffer
- only valid for STRING this is the offsets into the hostDataBuffer indicating the start and end of a string entry. It should be (rows + 1) ints.nestedHcv
- list of child HostColumnVectorCore(s) for complex types
-
-
Method Details
-
setEventHandler
Set an event handler for this host vector. This method can be invoked with null to unset the handler.- Parameters:
newHandler
- - the EventHandler to use from this point forward- Returns:
- the prior event handler, or null if not set.
-
getEventHandler
Returns the current event handler for this HostColumnVector or null if no handler is associated. -
noWarnLeakExpected
public void noWarnLeakExpected()This is a really ugly API, but it is possible that the lifecycle of a column of data may not have a clear lifecycle thanks to java and GC. This API informs the leak tracking code that this is expected for this column, and big scary warnings should not be printed when this happens. -
close
public void close()Close this Vector and free memory allocated for HostMemoryBuffer and DeviceMemoryBuffer- Specified by:
close
in interfaceAutoCloseable
- Overrides:
close
in classHostColumnVectorCore
-
toString
- Overrides:
toString
in classHostColumnVectorCore
-
incRefCount
Increment the reference count for this column. You need to call close on this to decrement the reference count again. -
getRefCount
public int getRefCount()Returns this column's current refcount -
copyToDevice
Copy the data to the device. -
builder
Create a new Builder to hold the specified number of rows. Be sure to close the builder when done with it. Please try to use instead to avoid needing to close the builder.- Parameters:
type
- the type of vector to build.rows
- the number of rows this builder can hold- Returns:
- the builder to use.
-
builder
Create a new Builder to hold the specified number of rows and with enough space to hold the given amount of string data. Be sure to close the builder when done with it. Please try to use instead to avoid needing to close the builder.- Parameters:
rows
- the number of rows this builder can holdstringBufferSize
- the size of the string buffer to allocate.- Returns:
- the builder to use.
-
build
Create a new vector.- Parameters:
type
- the type of vector to build.rows
- maximum number of rows that the vector can hold.init
- what will initialize the vector.- Returns:
- the created vector.
-
build
public static HostColumnVector build(int rows, long stringBufferSize, Consumer<HostColumnVector.Builder> init) -
fromLists
-
fromStructs
public static HostColumnVector fromStructs(HostColumnVector.DataType dataType, List<HostColumnVector.StructData> values) -
fromStructs
public static HostColumnVector fromStructs(HostColumnVector.DataType dataType, HostColumnVector.StructData... values) -
emptyStructs
-
boolFromBytes
Create a new vector from the given values. -
fromBytes
Create a new vector from the given values. -
fromUnsignedBytes
Create a new vector from the given values.Java does not have an unsigned byte type, so the values will be treated as if the bits represent an unsigned value.
-
fromShorts
Create a new vector from the given values. -
fromUnsignedShorts
Create a new vector from the given values.Java does not have an unsigned short type, so the values will be treated as if the bits represent an unsigned value.
-
durationNanosecondsFromLongs
Create a new vector from the given values. -
durationMicrosecondsFromLongs
Create a new vector from the given values. -
durationMillisecondsFromLongs
Create a new vector from the given values. -
durationSecondsFromLongs
Create a new vector from the given values. -
durationDaysFromInts
Create a new vector from the given values. -
fromInts
Create a new vector from the given values. -
fromUnsignedInts
Create a new vector from the given values.Java does not have an unsigned int type, so the values will be treated as if the bits represent an unsigned value.
-
fromLongs
Create a new vector from the given values. -
fromUnsignedLongs
Create a new vector from the given values.Java does not have an unsigned long type, so the values will be treated as if the bits represent an unsigned value.
-
fromFloats
Create a new vector from the given values. -
fromDoubles
Create a new vector from the given values. -
daysFromInts
Create a new vector from the given values. -
timestampSecondsFromLongs
Create a new vector from the given values. -
timestampMilliSecondsFromLongs
Create a new vector from the given values. -
timestampMicroSecondsFromLongs
Create a new vector from the given values. -
timestampNanoSecondsFromLongs
Create a new vector from the given values. -
decimalFromInts
Create a new decimal vector from unscaled values (int array) and scale. The created vector is of type DType.DECIMAL32, whose max precision is 9. Compared with scale of [[java.math.BigDecimal]], the scale here represents the opposite meaning. -
decimalFromBoxedInts
Create a new decimal vector from boxed unscaled values (Integer array) and scale. The created vector is of type DType.DECIMAL32, whose max precision is 9. Compared with scale of [[java.math.BigDecimal]], the scale here represents the opposite meaning. -
decimalFromLongs
Create a new decimal vector from unscaled values (long array) and scale. The created vector is of type DType.DECIMAL64, whose max precision is 18. Compared with scale of [[java.math.BigDecimal]], the scale here represents the opposite meaning. -
decimalFromBoxedLongs
Create a new decimal vector from boxed unscaled values (Long array) and scale. The created vector is of type DType.DECIMAL64, whose max precision is 18. Compared with scale of [[java.math.BigDecimal]], the scale here represents the opposite meaning. -
decimalFromBigIntegers
Create a new decimal vector from unscaled values (BigInteger array) and scale. The created vector is of type DType.DECIMAL128. Compared with scale of [[java.math.BigDecimal]], the scale here represents the opposite meaning. -
decimalFromDoubles
Create a new decimal vector from double floats with specific DecimalType and RoundingMode. All doubles will be rescaled if necessary, according to scale of input DecimalType and RoundingMode. If any overflow occurs in extracting integral part, an IllegalArgumentException will be thrown. This API is inefficient because of slow double -> decimal conversion, so it is mainly for testing. Compared with scale of [[java.math.BigDecimal]], the scale here represents the opposite meaning. -
fromStrings
Create a new string vector from the given values. This API supports inline nulls. This is really intended to be used only for testing as it is slow and memory intensive to translate between java strings and UTF8 strings. -
fromUTF8Strings
Create a new string vector from the given values. This API supports inline nulls. -
fromDecimals
Create a new vector from the given values. This API supports inline nulls, but is much slower than building from primitive array of unscaledValues. Notice: 1. Input values will be rescaled with min scale (max scale in terms of java.math.BigDecimal), which avoids potential precision loss due to rounding. But there exists risk of precision overflow. 2. The scale will be zero if all input values are null. -
fromBoxedBooleans
Create a new vector from the given values. This API supports inline nulls, but is much slower than using a regular array and should really only be used for tests. -
fromBoxedBytes
Create a new vector from the given values. This API supports inline nulls, but is much slower than using a regular array and should really only be used for tests. -
fromBoxedUnsignedBytes
Create a new vector from the given values. This API supports inline nulls, but is much slower than using a regular array and should really only be used for tests.Java does not have an unsigned byte type, so the values will be treated as if the bits represent an unsigned value.
-
fromBoxedShorts
Create a new vector from the given values. This API supports inline nulls, but is much slower than using a regular array and should really only be used for tests. -
fromBoxedUnsignedShorts
Create a new vector from the given values. This API supports inline nulls, but is much slower than using a regular array and should really only be used for tests.Java does not have an unsigned short type, so the values will be treated as if the bits represent an unsigned value.
-
durationNanosecondsFromBoxedLongs
Create a new vector from the given values. This API supports inline nulls, but is much slower than using a regular array and should really only be used for tests. -
durationMicrosecondsFromBoxedLongs
Create a new vector from the given values. This API supports inline nulls, but is much slower than using a regular array and should really only be used for tests. -
durationMillisecondsFromBoxedLongs
Create a new vector from the given values. This API supports inline nulls, but is much slower than using a regular array and should really only be used for tests. -
durationSecondsFromBoxedLongs
Create a new vector from the given values. This API supports inline nulls, but is much slower than using a regular array and should really only be used for tests. -
durationDaysFromBoxedInts
Create a new vector from the given values. This API supports inline nulls, but is much slower than using a regular array and should really only be used for tests. -
fromBoxedInts
Create a new vector from the given values. This API supports inline nulls, but is much slower than using a regular array and should really only be used for tests. -
fromBoxedUnsignedInts
Create a new vector from the given values. This API supports inline nulls, but is much slower than using a regular array and should really only be used for tests.Java does not have an unsigned int type, so the values will be treated as if the bits represent an unsigned value.
-
fromBoxedLongs
Create a new vector from the given values. This API supports inline nulls, but is much slower than using a regular array and should really only be used for tests. -
fromBoxedUnsignedLongs
Create a new vector from the given values. This API supports inline nulls, but is much slower than using a regular array and should really only be used for tests.Java does not have an unsigned long type, so the values will be treated as if the bits represent an unsigned value.
-
fromBoxedFloats
Create a new vector from the given values. This API supports inline nulls, but is much slower than using a regular array and should really only be used for tests. -
fromBoxedDoubles
Create a new vector from the given values. This API supports inline nulls, but is much slower than using a regular array and should really only be used for tests. -
timestampDaysFromBoxedInts
Create a new vector from the given values. This API supports inline nulls, but is much slower than using a regular array and should really only be used for tests. -
timestampSecondsFromBoxedLongs
Create a new vector from the given values. This API supports inline nulls, but is much slower than using a regular array and should really only be used for tests. -
timestampMilliSecondsFromBoxedLongs
Create a new vector from the given values. This API supports inline nulls, but is much slower than using a regular array and should really only be used for tests. -
timestampMicroSecondsFromBoxedLongs
Create a new vector from the given values. This API supports inline nulls, but is much slower than using a regular array and should really only be used for tests. -
timestampNanoSecondsFromBoxedLongs
Create a new vector from the given values. This API supports inline nulls, but is much slower than using a regular array and should really only be used for tests.
-