Class ArrowColumnVector
- All Implemented Interfaces:
AutoCloseable
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Cleans up memory for this column vector.getArray
(int rowId) Returns the array type value forrowId
.byte[]
getBinary
(int rowId) Returns the binary type value forrowId
.boolean
getBoolean
(int rowId) Returns the boolean type value forrowId
.byte
getByte
(int rowId) Returns the byte type value forrowId
.getChild
(int ordinal) getDecimal
(int rowId, int precision, int scale) Returns the decimal type value forrowId
.double
getDouble
(int rowId) Returns the double type value forrowId
.float
getFloat
(int rowId) Returns the float type value forrowId
.int
getInt
(int rowId) Returns the int type value forrowId
.getInterval
(int rowId) Returns the calendar interval type value forrowId
.long
getLong
(int rowId) Returns the long type value forrowId
.getMap
(int rowId) Returns the map type value forrowId
.short
getShort
(int rowId) Returns the short type value forrowId
.org.apache.spark.unsafe.types.UTF8String
getUTF8String
(int rowId) Returns the string type value forrowId
.org.apache.arrow.vector.ValueVector
boolean
hasNull()
Returns true if this column vector contains any null values.boolean
isNullAt
(int rowId) Returns whether the value atrowId
is NULL.int
numNulls()
Returns the number of nulls in this column vector.Methods inherited from class org.apache.spark.sql.vectorized.ColumnVector
dataType, getBooleans, getBytes, getDoubles, getFloats, getInts, getLongs, getShorts, getStruct, getVariant
-
Constructor Details
-
ArrowColumnVector
public ArrowColumnVector(org.apache.arrow.vector.ValueVector vector)
-
-
Method Details
-
getValueVector
public org.apache.arrow.vector.ValueVector getValueVector() -
hasNull
public boolean hasNull()Description copied from class:ColumnVector
Returns true if this column vector contains any null values.- Specified by:
hasNull
in classColumnVector
-
numNulls
public int numNulls()Description copied from class:ColumnVector
Returns the number of nulls in this column vector.- Specified by:
numNulls
in classColumnVector
-
close
public void close()Description copied from class:ColumnVector
Cleans up memory for this column vector. The column vector is not usable after this.This overwrites
AutoCloseable.close()
to remove thethrows
clause, as column vector is in-memory and we don't expect any exception to happen during closing.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in classColumnVector
-
isNullAt
public boolean isNullAt(int rowId) Description copied from class:ColumnVector
Returns whether the value atrowId
is NULL.- Specified by:
isNullAt
in classColumnVector
-
getBoolean
public boolean getBoolean(int rowId) Description copied from class:ColumnVector
Returns the boolean type value forrowId
. The return value is undefined and can be anything, if the slot forrowId
is null.- Specified by:
getBoolean
in classColumnVector
-
getByte
public byte getByte(int rowId) Description copied from class:ColumnVector
Returns the byte type value forrowId
. The return value is undefined and can be anything, if the slot forrowId
is null.- Specified by:
getByte
in classColumnVector
-
getShort
public short getShort(int rowId) Description copied from class:ColumnVector
Returns the short type value forrowId
. The return value is undefined and can be anything, if the slot forrowId
is null.- Specified by:
getShort
in classColumnVector
-
getInt
public int getInt(int rowId) Description copied from class:ColumnVector
Returns the int type value forrowId
. The return value is undefined and can be anything, if the slot forrowId
is null.- Specified by:
getInt
in classColumnVector
-
getLong
public long getLong(int rowId) Description copied from class:ColumnVector
Returns the long type value forrowId
. The return value is undefined and can be anything, if the slot forrowId
is null.- Specified by:
getLong
in classColumnVector
-
getFloat
public float getFloat(int rowId) Description copied from class:ColumnVector
Returns the float type value forrowId
. The return value is undefined and can be anything, if the slot forrowId
is null.- Specified by:
getFloat
in classColumnVector
-
getDouble
public double getDouble(int rowId) Description copied from class:ColumnVector
Returns the double type value forrowId
. The return value is undefined and can be anything, if the slot forrowId
is null.- Specified by:
getDouble
in classColumnVector
-
getDecimal
Description copied from class:ColumnVector
Returns the decimal type value forrowId
. If the slot forrowId
is null, it should return null.- Specified by:
getDecimal
in classColumnVector
-
getUTF8String
public org.apache.spark.unsafe.types.UTF8String getUTF8String(int rowId) Description copied from class:ColumnVector
Returns the string type value forrowId
. If the slot forrowId
is null, it should return null.Note that the returned
UTF8String
may point to the data of this column vector, please copy it if you want to keep it after this column vector is freed.- Specified by:
getUTF8String
in classColumnVector
-
getInterval
Description copied from class:ColumnVector
Returns the calendar interval type value forrowId
. If the slot forrowId
is null, it should return null.In Spark, calendar interval type value is basically two integer values representing the number of months and days in this interval, and a long value representing the number of microseconds in this interval. An interval type vector is the same as a struct type vector with 3 fields:
months
,days
andmicroseconds
.To support interval type, implementations must implement
ColumnVector.getChild(int)
and define 3 child vectors: the first child vector is an int type vector, containing all the month values of all the interval values in this vector. The second child vector is an int type vector, containing all the day values of all the interval values in this vector. The third child vector is a long type vector, containing all the microsecond values of all the interval values in this vector. Note that the ArrowColumnVector leverages its built-in IntervalMonthDayNanoVector instead of above-mentioned protocol.- Overrides:
getInterval
in classColumnVector
-
getBinary
public byte[] getBinary(int rowId) Description copied from class:ColumnVector
Returns the binary type value forrowId
. If the slot forrowId
is null, it should return null.- Specified by:
getBinary
in classColumnVector
-
getArray
Description copied from class:ColumnVector
Returns the array type value forrowId
. If the slot forrowId
is null, it should return null.To support array type, implementations must construct an
ColumnarArray
and return it in this method.ColumnarArray
requires aColumnVector
that stores the data of all the elements of all the arrays in this vector, and an offset and length which points to a range in thatColumnVector
, and the range represents the array for rowId. Implementations are free to decide where to put the data vector and offsets and lengths. For example, we can use the first child vector as the data vector, and store offsets and lengths in 2 int arrays in this vector.- Specified by:
getArray
in classColumnVector
-
getMap
Description copied from class:ColumnVector
Returns the map type value forrowId
. If the slot forrowId
is null, it should return null.In Spark, map type value is basically a key data array and a value data array. A key from the key array with a index and a value from the value array with the same index contribute to an entry of this map type value.
To support map type, implementations must construct a
ColumnarMap
and return it in this method.ColumnarMap
requires aColumnVector
that stores the data of all the keys of all the maps in this vector, and anotherColumnVector
that stores the data of all the values of all the maps in this vector, and a pair of offset and length which specify the range of the key/value array that belongs to the map type value at rowId.- Specified by:
getMap
in classColumnVector
-
getChild
- Specified by:
getChild
in classColumnVector
- Returns:
- child
ColumnVector
at the given ordinal.
-