@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.
|
dataType, getBooleans, getBytes, getDoubles, getFloats, getInterval, getInts, getLongs, getShorts, getStruct
public ArrowColumnVector(org.apache.arrow.vector.ValueVector vector)
public org.apache.arrow.vector.ValueVector getValueVector()
public boolean hasNull()
ColumnVector
hasNull
in class ColumnVector
public int numNulls()
ColumnVector
numNulls
in class ColumnVector
public 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 AutoCloseable
close
in class ColumnVector
public boolean isNullAt(int rowId)
ColumnVector
rowId
is NULL.isNullAt
in class ColumnVector
public boolean getBoolean(int rowId)
ColumnVector
rowId
. The return value is undefined and can be
anything, if the slot for rowId
is null.getBoolean
in class ColumnVector
public byte getByte(int rowId)
ColumnVector
rowId
. The return value is undefined and can be
anything, if the slot for rowId
is null.getByte
in class ColumnVector
public short getShort(int rowId)
ColumnVector
rowId
. The return value is undefined and can be
anything, if the slot for rowId
is null.getShort
in class ColumnVector
public int getInt(int rowId)
ColumnVector
rowId
. The return value is undefined and can be
anything, if the slot for rowId
is null.getInt
in class ColumnVector
public long getLong(int rowId)
ColumnVector
rowId
. The return value is undefined and can be
anything, if the slot for rowId
is null.getLong
in class ColumnVector
public float getFloat(int rowId)
ColumnVector
rowId
. The return value is undefined and can be
anything, if the slot for rowId
is null.getFloat
in class ColumnVector
public double getDouble(int rowId)
ColumnVector
rowId
. The return value is undefined and can be
anything, if the slot for rowId
is null.getDouble
in class ColumnVector
public Decimal getDecimal(int rowId, int precision, int scale)
ColumnVector
rowId
. If the slot for rowId
is null, it
should return null.getDecimal
in class ColumnVector
public org.apache.spark.unsafe.types.UTF8String getUTF8String(int rowId)
ColumnVector
rowId
. 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 ColumnVector
public byte[] getBinary(int rowId)
ColumnVector
rowId
. If the slot for rowId
is null, it
should return null.getBinary
in class ColumnVector
public ColumnarArray getArray(int rowId)
ColumnVector
rowId
. 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 ColumnVector
public ColumnarMap getMap(int rowId)
ColumnVector
rowId
. 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 ColumnVector
public ArrowColumnVector getChild(int ordinal)
getChild
in class ColumnVector
ColumnVector
at the given ordinal.