public final class BinaryArray extends BinarySection implements BaseArray
[numElements(int)] + [null bits(4-byte word boundaries)] + [values or offset&length] + [variable length part].
BinaryArray
are influenced by Apache Spark UnsafeArrayData.
offset, segments, sizeInBytes
HIGHEST_FIRST_BIT, HIGHEST_SECOND_TO_EIGHTH_BIT, MAX_FIX_PART_DATA_SIZE
Constructor and Description |
---|
BinaryArray() |
Modifier and Type | Method and Description |
---|---|
boolean |
anyNull() |
static int |
calculateFixLengthPartSize(LogicalType type)
It store real value when type is primitive.
|
static int |
calculateHeaderInBytes(int numFields) |
BinaryArray |
copy() |
BinaryArray |
copy(BinaryArray reuse) |
static BinaryArray |
fromPrimitiveArray(boolean[] arr) |
static BinaryArray |
fromPrimitiveArray(byte[] arr) |
static BinaryArray |
fromPrimitiveArray(double[] arr) |
static BinaryArray |
fromPrimitiveArray(float[] arr) |
static BinaryArray |
fromPrimitiveArray(int[] arr) |
static BinaryArray |
fromPrimitiveArray(long[] arr) |
static BinaryArray |
fromPrimitiveArray(short[] arr) |
BaseArray |
getArray(int pos)
Get array value, internal format is BaseArray.
|
byte[] |
getBinary(int pos)
Get binary value, internal format is byte[].
|
boolean |
getBoolean(int pos)
Get boolean value.
|
byte |
getByte(int pos)
Get byte value.
|
Decimal |
getDecimal(int pos,
int precision,
int scale)
Get decimal value, internal format is Decimal.
|
double |
getDouble(int pos)
Get double value.
|
float |
getFloat(int pos)
Get float value.
|
<T> BinaryGeneric<T> |
getGeneric(int pos)
Get generic value, internal format is BinaryGeneric.
|
int |
getInt(int pos)
Get int value.
|
long |
getLong(int pos)
Get long value.
|
BaseMap |
getMap(int pos)
Get map value, internal format is BaseMap.
|
BaseRow |
getRow(int pos,
int numFields)
Get row value, internal format is BaseRow.
|
short |
getShort(int pos)
Get short value.
|
BinaryString |
getString(int pos)
Get string value, internal format is BinaryString.
|
int |
hashCode() |
boolean |
isNullAt(int pos)
Because the specific row implementation such as BinaryRow uses the binary format.
|
int |
numElements() |
void |
pointTo(MemorySegment[] segments,
int offset,
int sizeInBytes) |
void |
setBoolean(int pos,
boolean value)
Set boolean value.
|
void |
setByte(int pos,
byte value)
Set byte value.
|
void |
setDecimal(int pos,
Decimal value,
int precision)
Set the decimal column value.
|
void |
setDouble(int pos,
double value)
Set double value.
|
void |
setFloat(int pos,
float value)
Set float value.
|
void |
setInt(int pos,
int value)
Set int value.
|
void |
setLong(int pos,
long value)
Set long value.
|
void |
setNotNullAt(int pos) |
void |
setNullAt(int pos)
Set null to this field.
|
void |
setNullBoolean(int pos) |
void |
setNullByte(int pos) |
void |
setNullDouble(int pos) |
void |
setNullFloat(int pos) |
void |
setNullInt(int pos) |
void |
setNullLong(int pos) |
void |
setNullShort(int pos) |
void |
setShort(int pos,
short value)
Set short value.
|
boolean[] |
toBooleanArray() |
byte[] |
toByteArray() |
<T> T[] |
toClassArray(LogicalType elementType,
Class<T> elementClass) |
double[] |
toDoubleArray() |
float[] |
toFloatArray() |
int[] |
toIntArray() |
long[] |
toLongArray() |
short[] |
toShortArray() |
equals, getOffset, getSegments, getSizeInBytes, pointTo
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
get
readBinaryFieldFromSegments, readBinaryStringFieldFromSegments
public static int calculateHeaderInBytes(int numFields)
public static int calculateFixLengthPartSize(LogicalType type)
public int numElements()
numElements
in interface BaseArray
public void pointTo(MemorySegment[] segments, int offset, int sizeInBytes)
pointTo
in class BinarySection
public boolean isNullAt(int pos)
TypeGetterSetters
isNullAt
in interface BaseArray
isNullAt
in interface TypeGetterSetters
public void setNullAt(int pos)
TypeGetterSetters
setNullAt
in interface BaseArray
setNullAt
in interface TypeGetterSetters
public void setNotNullAt(int pos)
setNotNullAt
in interface BaseArray
public long getLong(int pos)
TypeGetterSetters
getLong
in interface TypeGetterSetters
public void setLong(int pos, long value)
TypeGetterSetters
setLong
in interface TypeGetterSetters
public void setNullLong(int pos)
setNullLong
in interface BaseArray
public int getInt(int pos)
TypeGetterSetters
getInt
in interface TypeGetterSetters
public void setInt(int pos, int value)
TypeGetterSetters
setInt
in interface TypeGetterSetters
public void setNullInt(int pos)
setNullInt
in interface BaseArray
public BinaryString getString(int pos)
TypeGetterSetters
getString
in interface TypeGetterSetters
public Decimal getDecimal(int pos, int precision, int scale)
TypeGetterSetters
getDecimal
in interface TypeGetterSetters
public <T> BinaryGeneric<T> getGeneric(int pos)
TypeGetterSetters
getGeneric
in interface TypeGetterSetters
public byte[] getBinary(int pos)
TypeGetterSetters
getBinary
in interface TypeGetterSetters
public BaseArray getArray(int pos)
TypeGetterSetters
getArray
in interface TypeGetterSetters
public BaseMap getMap(int pos)
TypeGetterSetters
getMap
in interface TypeGetterSetters
public BaseRow getRow(int pos, int numFields)
TypeGetterSetters
getRow
in interface TypeGetterSetters
public boolean getBoolean(int pos)
TypeGetterSetters
getBoolean
in interface TypeGetterSetters
public void setBoolean(int pos, boolean value)
TypeGetterSetters
setBoolean
in interface TypeGetterSetters
public void setNullBoolean(int pos)
setNullBoolean
in interface BaseArray
public byte getByte(int pos)
TypeGetterSetters
getByte
in interface TypeGetterSetters
public void setByte(int pos, byte value)
TypeGetterSetters
setByte
in interface TypeGetterSetters
public void setNullByte(int pos)
setNullByte
in interface BaseArray
public short getShort(int pos)
TypeGetterSetters
getShort
in interface TypeGetterSetters
public void setShort(int pos, short value)
TypeGetterSetters
setShort
in interface TypeGetterSetters
public void setNullShort(int pos)
setNullShort
in interface BaseArray
public float getFloat(int pos)
TypeGetterSetters
getFloat
in interface TypeGetterSetters
public void setFloat(int pos, float value)
TypeGetterSetters
setFloat
in interface TypeGetterSetters
public void setNullFloat(int pos)
setNullFloat
in interface BaseArray
public double getDouble(int pos)
TypeGetterSetters
getDouble
in interface TypeGetterSetters
public void setDouble(int pos, double value)
TypeGetterSetters
setDouble
in interface TypeGetterSetters
public void setNullDouble(int pos)
setNullDouble
in interface BaseArray
public void setDecimal(int pos, Decimal value, int precision)
TypeGetterSetters
Note: Precision is compact: can call setNullAt when decimal is null. Precision is not compact: can not call setNullAt when decimal is null, must call setDecimal(i, null, precision) because we need update var-length-part.
setDecimal
in interface TypeGetterSetters
public boolean anyNull()
public boolean[] toBooleanArray()
toBooleanArray
in interface BaseArray
public byte[] toByteArray()
toByteArray
in interface BaseArray
public short[] toShortArray()
toShortArray
in interface BaseArray
public int[] toIntArray()
toIntArray
in interface BaseArray
public long[] toLongArray()
toLongArray
in interface BaseArray
public float[] toFloatArray()
toFloatArray
in interface BaseArray
public double[] toDoubleArray()
toDoubleArray
in interface BaseArray
public <T> T[] toClassArray(LogicalType elementType, Class<T> elementClass)
public BinaryArray copy()
public BinaryArray copy(BinaryArray reuse)
public int hashCode()
hashCode
in class BinarySection
public static BinaryArray fromPrimitiveArray(boolean[] arr)
public static BinaryArray fromPrimitiveArray(byte[] arr)
public static BinaryArray fromPrimitiveArray(short[] arr)
public static BinaryArray fromPrimitiveArray(int[] arr)
public static BinaryArray fromPrimitiveArray(long[] arr)
public static BinaryArray fromPrimitiveArray(float[] arr)
public static BinaryArray fromPrimitiveArray(double[] arr)
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.