public abstract class TiColumnVector extends Object implements AutoCloseable
Most of the APIs take the rowId as a parameter. This is the batch local 0-based row id for values in this TiColumnVector.
Spark only calls specific `get` method according to the data type of this TiColumnVector
, e.g. if it's int type, Spark is guaranteed to only call getInt(int)
or
getInts(int, int)
.
TiColumnVector is expected to be reused during the entire data loading process, to avoid allocating memory again and again.
Modifier and Type | Field and Description |
---|---|
protected DataType |
type
Data type for this column.
|
Modifier | Constructor and Description |
---|---|
protected |
TiColumnVector(DataType type,
int numOfRows)
Sets up the data type of this column vector.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
close()
Cleans up memory for this column vector.
|
DataType |
dataType()
Returns the data type of this column vector.
|
abstract byte[] |
getBinary(int rowId)
Returns the binary type value for rowId.
|
abstract boolean |
getBoolean(int rowId)
Returns the boolean type value for rowId.
|
boolean[] |
getBooleans(int rowId,
int count)
Gets boolean type values from [rowId, rowId + count).
|
abstract byte |
getByte(int rowId)
Returns the byte type value for rowId.
|
byte[] |
getBytes(int rowId,
int count)
Gets byte type values from [rowId, rowId + count).
|
protected abstract TiColumnVector |
getChild(int ordinal) |
abstract BigDecimal |
getDecimal(int rowId,
int precision,
int scale)
Returns the decimal type value for rowId.
|
abstract double |
getDouble(int rowId)
Returns the double type value for rowId.
|
double[] |
getDoubles(int rowId,
int count)
Gets double type values from [rowId, rowId + count).
|
abstract float |
getFloat(int rowId)
Returns the float type value for rowId.
|
float[] |
getFloats(int rowId,
int count)
Gets float type values from [rowId, rowId + count).
|
abstract int |
getInt(int rowId)
Returns the int type value for rowId.
|
int[] |
getInts(int rowId,
int count)
Gets int type values from [rowId, rowId + count).
|
abstract long |
getLong(int rowId)
Returns the long type value for rowId.
|
long[] |
getLongs(int rowId,
int count)
Gets long type values from [rowId, rowId + count).
|
abstract short |
getShort(int rowId)
Returns the short type value for rowId.
|
short[] |
getShorts(int rowId,
int count)
Gets short type values from [rowId, rowId + count).
|
abstract String |
getUTF8String(int rowId)
Returns the string type value for rowId.
|
abstract boolean |
hasNull()
Returns true if this column vector contains any null values.
|
abstract boolean |
isNullAt(int rowId)
Returns whether the value at rowId is NULL.
|
abstract int |
numNulls()
Returns the number of nulls in this column vector.
|
int |
numOfRows() |
protected DataType type
protected TiColumnVector(DataType type, int numOfRows)
public final DataType dataType()
public abstract void close()
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
public abstract boolean hasNull()
public abstract int numNulls()
public abstract boolean isNullAt(int rowId)
public abstract boolean getBoolean(int rowId)
public boolean[] getBooleans(int rowId, int count)
public abstract byte getByte(int rowId)
public byte[] getBytes(int rowId, int count)
public abstract short getShort(int rowId)
public short[] getShorts(int rowId, int count)
public abstract int getInt(int rowId)
public int[] getInts(int rowId, int count)
public abstract long getLong(int rowId)
public long[] getLongs(int rowId, int count)
public abstract float getFloat(int rowId)
public float[] getFloats(int rowId, int count)
public abstract double getDouble(int rowId)
public double[] getDoubles(int rowId, int count)
public abstract BigDecimal getDecimal(int rowId, int precision, int scale)
public abstract String getUTF8String(int rowId)
public abstract byte[] getBinary(int rowId)
protected abstract TiColumnVector getChild(int ordinal)
public int numOfRows()
Copyright © 2024 PingCAP. All rights reserved.