@DeveloperApi public class ArrowColumnVector extends ColumnVector
| Constructor and Description |
|---|
ArrowColumnVector(org.apache.arrow.vector.ValueVector vector) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Cleans up memory for this column vector.
|
ColumnarArray |
getArray(int rowId)
Returns the array type value for
rowId. |
byte[] |
getBinary(int rowId)
Returns the binary type value for
rowId. |
boolean |
getBoolean(int rowId)
Returns the boolean type value for
rowId. |
byte |
getByte(int rowId)
Returns the byte type value for
rowId. |
ArrowColumnVector |
getChild(int ordinal) |
Decimal |
getDecimal(int rowId,
int precision,
int scale)
Returns the decimal type value for
rowId. |
double |
getDouble(int rowId)
Returns the double type value for
rowId. |
float |
getFloat(int rowId)
Returns the float type value for
rowId. |
int |
getInt(int rowId)
Returns the int type value for
rowId. |
long |
getLong(int rowId)
Returns the long type value for
rowId. |
ColumnarMap |
getMap(int rowId)
Returns the map type value for
rowId. |
short |
getShort(int rowId)
Returns the short type value for
rowId. |
org.apache.spark.unsafe.types.UTF8String |
getUTF8String(int rowId)
Returns the string type value for
rowId. |
org.apache.arrow.vector.ValueVector |
getValueVector() |
boolean |
hasNull()
Returns true if this column vector contains any null values.
|
boolean |
isNullAt(int rowId)
Returns whether the value at
rowId is NULL. |
int |
numNulls()
Returns the number of nulls in this column vector.
|
closeIfFreeable, dataType, getBooleans, getBytes, getDoubles, getFloats, getInterval, getInts, getLongs, getShorts, getStructpublic ArrowColumnVector(org.apache.arrow.vector.ValueVector vector)
public org.apache.arrow.vector.ValueVector getValueVector()
public boolean hasNull()
ColumnVectorhasNull in class ColumnVectorpublic int numNulls()
ColumnVectornumNulls in class ColumnVectorpublic void close()
ColumnVector
This overwrites AutoCloseable.close() to remove the
throws clause, as column vector is in-memory and we don't expect any exception to
happen during closing.
close in interface AutoCloseableclose in class ColumnVectorpublic boolean isNullAt(int rowId)
ColumnVectorrowId is NULL.isNullAt in class ColumnVectorpublic boolean getBoolean(int rowId)
ColumnVectorrowId. The return value is undefined and can be
anything, if the slot for rowId is null.getBoolean in class ColumnVectorpublic byte getByte(int rowId)
ColumnVectorrowId. The return value is undefined and can be
anything, if the slot for rowId is null.getByte in class ColumnVectorpublic short getShort(int rowId)
ColumnVectorrowId. The return value is undefined and can be
anything, if the slot for rowId is null.getShort in class ColumnVectorpublic int getInt(int rowId)
ColumnVectorrowId. The return value is undefined and can be
anything, if the slot for rowId is null.getInt in class ColumnVectorpublic long getLong(int rowId)
ColumnVectorrowId. The return value is undefined and can be
anything, if the slot for rowId is null.getLong in class ColumnVectorpublic float getFloat(int rowId)
ColumnVectorrowId. The return value is undefined and can be
anything, if the slot for rowId is null.getFloat in class ColumnVectorpublic double getDouble(int rowId)
ColumnVectorrowId. The return value is undefined and can be
anything, if the slot for rowId is null.getDouble in class ColumnVectorpublic Decimal getDecimal(int rowId, int precision, int scale)
ColumnVectorrowId. If the slot for rowId is null, it
should return null.getDecimal in class ColumnVectorpublic org.apache.spark.unsafe.types.UTF8String getUTF8String(int rowId)
ColumnVectorrowId. If the slot for rowId 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.
getUTF8String in class ColumnVectorpublic byte[] getBinary(int rowId)
ColumnVectorrowId. If the slot for rowId is null, it
should return null.getBinary in class ColumnVectorpublic ColumnarArray getArray(int rowId)
ColumnVectorrowId. If the slot for rowId is null, it
should return null.
To support array type, implementations must construct an ColumnarArray and return it in
this method. ColumnarArray requires a ColumnVector 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 that ColumnVector, 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.
getArray in class ColumnVectorpublic ColumnarMap getMap(int rowId)
ColumnVectorrowId. If the slot for rowId 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 a ColumnVector that stores the data of all
the keys of all the maps in this vector, and another ColumnVector 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.
getMap in class ColumnVectorpublic ArrowColumnVector getChild(int ordinal)
getChild in class ColumnVectorColumnVector at the given ordinal.