Class BinaryArrayWriter
- java.lang.Object
-
- org.apache.flink.table.data.writer.BinaryArrayWriter
-
- All Implemented Interfaces:
BinaryWriter
@Internal public final class BinaryArrayWriter extends Object
Writer for binary array. SeeBinaryArrayData
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
BinaryArrayWriter.NullSetter
Accessor for setting the elements of an array writer tonull
during runtime.-
Nested classes/interfaces inherited from interface org.apache.flink.table.data.writer.BinaryWriter
BinaryWriter.ValueSetter
-
-
Field Summary
Fields Modifier and Type Field Description protected int
cursor
protected DataOutputViewStreamWrapper
outputView
protected MemorySegment
segment
-
Constructor Summary
Constructors Constructor Description BinaryArrayWriter(BinaryArrayData array, int numElements, int elementSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
afterGrow()
After grow, need point to new memory.void
complete()
Finally, complete write to set real size to row.static BinaryArrayWriter.NullSetter
createNullSetter(LogicalType elementType)
Creates an for accessor setting the elements of an array writer tonull
during runtime.protected void
ensureCapacity(int neededSize)
int
getFieldOffset(int pos)
Get field offset.int
getNumElements()
MemorySegment
getSegments()
void
reset()
First, reset.protected static int
roundNumberOfBytesToNearestWord(int numBytes)
void
setNullAt(int ordinal)
Set null to this field.void
setNullAt(int pos, LogicalType type)
Deprecated.UsecreateNullSetter(LogicalType)
for avoiding logical types during runtime.void
setNullBit(int ordinal)
void
setNullBoolean(int ordinal)
void
setNullByte(int ordinal)
void
setNullDouble(int ordinal)
void
setNullFloat(int ordinal)
void
setNullInt(int ordinal)
void
setNullLong(int ordinal)
void
setNullShort(int ordinal)
void
setOffsetAndSize(int pos, int offset, long size)
Set offset and size to fix len part.void
writeArray(int pos, ArrayData input, ArrayDataSerializer serializer)
void
writeBinary(int pos, byte[] bytes)
void
writeBoolean(int pos, boolean value)
void
writeByte(int pos, byte value)
void
writeDecimal(int pos, DecimalData value, int precision)
void
writeDouble(int pos, double value)
void
writeFloat(int pos, float value)
void
writeInt(int pos, int value)
void
writeLong(int pos, long value)
void
writeMap(int pos, MapData input, MapDataSerializer serializer)
void
writeRawValue(int pos, RawValueData<?> input, RawValueDataSerializer<?> serializer)
void
writeRow(int pos, RowData input, RowDataSerializer serializer)
void
writeShort(int pos, short value)
void
writeString(int pos, StringData input)
void
writeTimestamp(int pos, TimestampData value, int precision)
protected void
zeroOutPaddingBytes(int numBytes)
-
-
-
Field Detail
-
segment
protected MemorySegment segment
-
cursor
protected int cursor
-
outputView
protected DataOutputViewStreamWrapper outputView
-
-
Constructor Detail
-
BinaryArrayWriter
public BinaryArrayWriter(BinaryArrayData array, int numElements, int elementSize)
-
-
Method Detail
-
reset
public void reset()
First, reset.
-
setNullBit
public void setNullBit(int ordinal)
-
setNullBoolean
public void setNullBoolean(int ordinal)
-
setNullByte
public void setNullByte(int ordinal)
-
setNullShort
public void setNullShort(int ordinal)
-
setNullInt
public void setNullInt(int ordinal)
-
setNullLong
public void setNullLong(int ordinal)
-
setNullFloat
public void setNullFloat(int ordinal)
-
setNullDouble
public void setNullDouble(int ordinal)
-
setNullAt
public void setNullAt(int ordinal)
Description copied from interface:BinaryWriter
Set null to this field.
-
setNullAt
@Deprecated public void setNullAt(int pos, LogicalType type)
Deprecated.UsecreateNullSetter(LogicalType)
for avoiding logical types during runtime.
-
getFieldOffset
public int getFieldOffset(int pos)
Get field offset.
-
setOffsetAndSize
public void setOffsetAndSize(int pos, int offset, long size)
Set offset and size to fix len part.
-
writeBoolean
public void writeBoolean(int pos, boolean value)
-
writeByte
public void writeByte(int pos, byte value)
-
writeShort
public void writeShort(int pos, short value)
-
writeInt
public void writeInt(int pos, int value)
-
writeLong
public void writeLong(int pos, long value)
-
writeFloat
public void writeFloat(int pos, float value)
-
writeDouble
public void writeDouble(int pos, double value)
-
afterGrow
public void afterGrow()
After grow, need point to new memory.
-
complete
public void complete()
Finally, complete write to set real size to row.
-
getNumElements
public int getNumElements()
-
createNullSetter
public static BinaryArrayWriter.NullSetter createNullSetter(LogicalType elementType)
Creates an for accessor setting the elements of an array writer tonull
during runtime.- Parameters:
elementType
- the element type of the array
-
writeString
public void writeString(int pos, StringData input)
- Specified by:
writeString
in interfaceBinaryWriter
-
writeArray
public void writeArray(int pos, ArrayData input, ArrayDataSerializer serializer)
- Specified by:
writeArray
in interfaceBinaryWriter
-
writeMap
public void writeMap(int pos, MapData input, MapDataSerializer serializer)
- Specified by:
writeMap
in interfaceBinaryWriter
-
writeRawValue
public void writeRawValue(int pos, RawValueData<?> input, RawValueDataSerializer<?> serializer)
- Specified by:
writeRawValue
in interfaceBinaryWriter
-
writeRow
public void writeRow(int pos, RowData input, RowDataSerializer serializer)
- Specified by:
writeRow
in interfaceBinaryWriter
-
writeBinary
public void writeBinary(int pos, byte[] bytes)
- Specified by:
writeBinary
in interfaceBinaryWriter
-
writeDecimal
public void writeDecimal(int pos, DecimalData value, int precision)
- Specified by:
writeDecimal
in interfaceBinaryWriter
-
writeTimestamp
public void writeTimestamp(int pos, TimestampData value, int precision)
- Specified by:
writeTimestamp
in interfaceBinaryWriter
-
zeroOutPaddingBytes
protected void zeroOutPaddingBytes(int numBytes)
-
ensureCapacity
protected void ensureCapacity(int neededSize)
-
roundNumberOfBytesToNearestWord
protected static int roundNumberOfBytesToNearestWord(int numBytes)
-
getSegments
@Internal public MemorySegment getSegments()
-
-