Class ArrowColumnVector
- All Implemented Interfaces:
AutoCloseable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()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.booleangetBoolean(int rowId) Returns the boolean type value forrowId.bytegetByte(int rowId) Returns the byte type value forrowId.getChild(int ordinal) getDecimal(int rowId, int precision, int scale) Returns the decimal type value forrowId.doublegetDouble(int rowId) Returns the double type value forrowId.floatgetFloat(int rowId) Returns the float type value forrowId.intgetInt(int rowId) Returns the int type value forrowId.getInterval(int rowId) Returns the calendar interval type value forrowId.longgetLong(int rowId) Returns the long type value forrowId.getMap(int rowId) Returns the map type value forrowId.shortgetShort(int rowId) Returns the short type value forrowId.org.apache.spark.unsafe.types.UTF8StringgetUTF8String(int rowId) Returns the string type value forrowId.org.apache.arrow.vector.ValueVectorbooleanhasNull()Returns true if this column vector contains any null values.booleanisNullAt(int rowId) Returns whether the value atrowIdis NULL.intnumNulls()Returns the number of nulls in this column vector.Methods inherited from class org.apache.spark.sql.vectorized.ColumnVector
closeIfFreeable, 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:ColumnVectorReturns true if this column vector contains any null values.- Specified by:
hasNullin classColumnVector
-
numNulls
public int numNulls()Description copied from class:ColumnVectorReturns the number of nulls in this column vector.- Specified by:
numNullsin classColumnVector
-
close
public void close()Description copied from class:ColumnVectorCleans up memory for this column vector. The column vector is not usable after this.This overwrites
AutoCloseable.close()to remove thethrowsclause, as column vector is in-memory and we don't expect any exception to happen during closing.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein classColumnVector
-
isNullAt
public boolean isNullAt(int rowId) Description copied from class:ColumnVectorReturns whether the value atrowIdis NULL.- Specified by:
isNullAtin classColumnVector
-
getBoolean
public boolean getBoolean(int rowId) Description copied from class:ColumnVectorReturns the boolean type value forrowId. The return value is undefined and can be anything, if the slot forrowIdis null.- Specified by:
getBooleanin classColumnVector
-
getByte
public byte getByte(int rowId) Description copied from class:ColumnVectorReturns the byte type value forrowId. The return value is undefined and can be anything, if the slot forrowIdis null.- Specified by:
getBytein classColumnVector
-
getShort
public short getShort(int rowId) Description copied from class:ColumnVectorReturns the short type value forrowId. The return value is undefined and can be anything, if the slot forrowIdis null.- Specified by:
getShortin classColumnVector
-
getInt
public int getInt(int rowId) Description copied from class:ColumnVectorReturns the int type value forrowId. The return value is undefined and can be anything, if the slot forrowIdis null.- Specified by:
getIntin classColumnVector
-
getLong
public long getLong(int rowId) Description copied from class:ColumnVectorReturns the long type value forrowId. The return value is undefined and can be anything, if the slot forrowIdis null.- Specified by:
getLongin classColumnVector
-
getFloat
public float getFloat(int rowId) Description copied from class:ColumnVectorReturns the float type value forrowId. The return value is undefined and can be anything, if the slot forrowIdis null.- Specified by:
getFloatin classColumnVector
-
getDouble
public double getDouble(int rowId) Description copied from class:ColumnVectorReturns the double type value forrowId. The return value is undefined and can be anything, if the slot forrowIdis null.- Specified by:
getDoublein classColumnVector
-
getDecimal
Description copied from class:ColumnVectorReturns the decimal type value forrowId. If the slot forrowIdis null, it should return null.- Specified by:
getDecimalin classColumnVector
-
getUTF8String
public org.apache.spark.unsafe.types.UTF8String getUTF8String(int rowId) Description copied from class:ColumnVectorReturns the string type value forrowId. If the slot forrowIdis null, it should return null.Note that the returned
UTF8Stringmay 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:
getUTF8Stringin classColumnVector
-
getInterval
Description copied from class:ColumnVectorReturns the calendar interval type value forrowId. If the slot forrowIdis 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,daysandmicroseconds.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:
getIntervalin classColumnVector
-
getBinary
public byte[] getBinary(int rowId) Description copied from class:ColumnVectorReturns the binary type value forrowId. If the slot forrowIdis null, it should return null.- Specified by:
getBinaryin classColumnVector
-
getArray
Description copied from class:ColumnVectorReturns the array type value forrowId. If the slot forrowIdis null, it should return null.To support array type, implementations must construct an
ColumnarArrayand return it in this method.ColumnarArrayrequires aColumnVectorthat 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:
getArrayin classColumnVector
-
getMap
Description copied from class:ColumnVectorReturns the map type value forrowId. If the slot forrowIdis 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
ColumnarMapand return it in this method.ColumnarMaprequires aColumnVectorthat stores the data of all the keys of all the maps in this vector, and anotherColumnVectorthat 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:
getMapin classColumnVector
-
getChild
- Specified by:
getChildin classColumnVector- Returns:
- child
ColumnVectorat the given ordinal.
-