Runtime classes required by a task manager for execution of table programs in Apache Flink's Blink planner
Core data structures for efficient columnar processing, type conversion between internal and external formats, and vectorized operations for high-performance analytics workloads.
Interfaces for accessing data in columnar format, providing efficient memory access patterns and enabling vectorized operations for analytical workloads.
/**
* Base interface for columnar data access
*/
interface ColumnVector {
/** Check if value at given row is null */
boolean isNullAt(int rowId);
/** Get number of rows in this vector */
int getLen();
}
/** Columnar access for boolean data */
interface BooleanColumnVector extends ColumnVector {
boolean getBoolean(int rowId);
}
/** Columnar access for integer data */
interface IntColumnVector extends ColumnVector {
int getInt(int rowId);
}
/** Columnar access for long data */
interface LongColumnVector extends ColumnVector {
long getLong(int rowId);
}
/** Columnar access for float data */
interface FloatColumnVector extends ColumnVector {
float getFloat(int rowId);
}
/** Columnar access for double data */
interface DoubleColumnVector extends ColumnVector {
double getDouble(int rowId);
}
/** Columnar access for byte array data */
interface BytesColumnVector extends ColumnVector {
/** Get bytes data at row position */
Bytes getBytes(int rowId);
/** Inner class for byte array handling with offset and length */
class Bytes {
/** Byte data */
public byte[] data;
/** Offset in data array */
public int offset;
/** Length of data */
public int len;
/** Create bytes wrapper */
Bytes(byte[] data, int offset, int len);
/** Set bytes data */
void setByteArray(byte[] data, int offset, int len);
}
}
/** Columnar access for decimal data */
interface DecimalColumnVector extends ColumnVector {
DecimalData getDecimal(int rowId, int precision, int scale);
}
/** Columnar access for timestamp data */
interface TimestampColumnVector extends ColumnVector {
TimestampData getTimestamp(int rowId, int precision);
}
/** Columnar access for array data */
interface ArrayColumnVector extends ColumnVector {
ArrayData getArray(int rowId);
}
/** Columnar access for row data */
interface RowColumnVector extends ColumnVector {
RowData getRow(int rowId);
}Main container for batch columnar processing, organizing multiple column vectors for efficient processing of tabular data.
/**
* Main class for batch columnar processing
* Organizes multiple column vectors for efficient tabular data processing
*/
class VectorizedColumnBatch {
/** Column vectors in this batch */
public final ColumnVector[] columns;
/** Default batch size for optimal performance */
public static final int DEFAULT_SIZE = 2048;
/**
* Create a new vectorized column batch
* @param vectors Array of column vectors to organize
*/
VectorizedColumnBatch(ColumnVector[] vectors);
/** Set the number of rows in this batch */
void setNumRows(int numRows);
/** Get the number of rows in this batch */
int getNumRows();
/** Get number of columns (arity) */
int getArity();
/** Check if value is null at given position */
boolean isNullAt(int rowId, int colId);
/** Get boolean value at position */
boolean getBoolean(int rowId, int colId);
/** Get byte value at position */
byte getByte(int rowId, int colId);
/** Get short value at position */
short getShort(int rowId, int colId);
/** Get integer value at position */
int getInt(int rowId, int colId);
/** Get long value at position */
long getLong(int rowId, int colId);
/** Get float value at position */
float getFloat(int rowId, int colId);
/** Get double value at position */
double getDouble(int rowId, int colId);
/** Get string value at position */
String getString(int rowId, int colId);
/** Get decimal value at position */
DecimalData getDecimal(int rowId, int colId, int precision, int scale);
/** Get timestamp value at position */
TimestampData getTimestamp(int rowId, int colId, int precision);
/** Get array value at position */
ArrayData getArray(int rowId, int colId);
/** Get row value at position */
RowData getRow(int rowId, int colId);
}Mutable column vector implementations that support writing data, used for building columnar data structures.
/**
* Base class for writable column vectors
*/
abstract class WritableColumnVector implements ColumnVector {
/** Set null value at given row */
void setNullAt(int rowId);
/** Set not null at given row */
void setNotNullAt(int rowId);
/** Reset the vector for reuse */
abstract void reset();
}
/** Writable boolean vector implementation */
class WritableBooleanVector extends WritableColumnVector
implements BooleanColumnVector {
/** Set boolean value at given row */
void setBoolean(int rowId, boolean value);
}
/** Writable integer vector implementation */
class WritableIntVector extends WritableColumnVector
implements IntColumnVector {
/** Set integer value at given row */
void setInt(int rowId, int value);
}
/** Writable long vector implementation */
class WritableLongVector extends WritableColumnVector
implements LongColumnVector {
/** Set long value at given row */
void setLong(int rowId, long value);
}
/** Writable float vector implementation */
class WritableFloatVector extends WritableColumnVector
implements FloatColumnVector {
/** Set float value at given row */
void setFloat(int rowId, float value);
}
/** Writable double vector implementation */
class WritableDoubleVector extends WritableColumnVector
implements DoubleColumnVector {
/** Set double value at given row */
void setDouble(int rowId, double value);
}
/** Writable byte vector implementation */
class WritableByteVector extends WritableColumnVector
implements ByteColumnVector {
/** Set byte value at given row */
void setByte(int rowId, byte value);
}
/** Writable bytes vector implementation */
class WritableBytesVector extends WritableColumnVector
implements BytesColumnVector {
/** Set bytes value at given row */
void setBytes(int rowId, byte[] value);
}
/** Writable timestamp vector implementation */
class WritableTimestampVector extends WritableColumnVector
implements TimestampColumnVector {
/** Set timestamp value at given row */
void setTimestamp(int rowId, TimestampData value);
}Concrete implementations of column vectors using heap memory storage, providing efficient storage for columnar data.
/** Heap-based boolean vector */
class HeapBooleanVector extends WritableBooleanVector {
HeapBooleanVector(int len);
}
/** Heap-based byte vector */
class HeapByteVector extends WritableByteVector {
HeapByteVector(int len);
}
/** Heap-based integer vector */
class HeapIntVector extends WritableIntVector {
HeapIntVector(int len);
}
/** Heap-based long vector */
class HeapLongVector extends WritableLongVector {
HeapLongVector(int len);
}
/** Heap-based float vector */
class HeapFloatVector extends WritableFloatVector {
HeapFloatVector(int len);
}
/** Heap-based double vector */
class HeapDoubleVector extends WritableDoubleVector {
HeapDoubleVector(int len);
}
/** Heap-based bytes vector */
class HeapBytesVector extends WritableBytesVector {
HeapBytesVector(int len);
}
/** Heap-based timestamp vector */
class HeapTimestampVector extends WritableTimestampVector {
HeapTimestampVector(int len);
}Framework for converting between Flink's internal data representations and external formats, enabling interoperability with various data processing systems.
/**
* Key interface for converting between internal and external data formats
* Enables interoperability between Flink's internal representations and external systems
*/
interface DataStructureConverter<I, E> {
/** Convert from internal format to external format */
E toExternal(I internal);
/** Convert from external format to internal format */
I toInternal(E external);
}Specialized converters for array data types, handling conversion between internal array representations and external array formats.
/** Convert boolean arrays */
class ArrayBooleanArrayConverter implements DataStructureConverter<ArrayData, boolean[]> {
ArrayBooleanArrayConverter();
}
/** Convert integer arrays */
class ArrayIntArrayConverter implements DataStructureConverter<ArrayData, int[]> {
ArrayIntArrayConverter();
}
/** Convert long arrays */
class ArrayLongArrayConverter implements DataStructureConverter<ArrayData, long[]> {
ArrayLongArrayConverter();
}
/** Convert float arrays */
class ArrayFloatArrayConverter implements DataStructureConverter<ArrayData, float[]> {
ArrayFloatArrayConverter();
}
/** Convert double arrays */
class ArrayDoubleArrayConverter implements DataStructureConverter<ArrayData, double[]> {
ArrayDoubleArrayConverter();
}
/** Convert string arrays */
class ArrayStringArrayConverter implements DataStructureConverter<ArrayData, String[]> {
ArrayStringArrayConverter();
}Converters for common Java collection types, enabling seamless integration with standard Java data structures.
/** Convert to/from ArrayList */
class ArrayListConverter<E> implements DataStructureConverter<ArrayData, ArrayList<E>> {
ArrayListConverter(DataStructureConverter<Object, E> elementConverter);
}
/** Convert to/from Map structures */
class MapMapConverter<K, V> implements DataStructureConverter<MapData, Map<K, V>> {
MapMapConverter(
DataStructureConverter<Object, K> keyConverter,
DataStructureConverter<Object, V> valueConverter
);
}Specialized converters for date, time, and timestamp data, handling conversion between internal temporal representations and Java temporal types.
/** Convert date data */
class DateDateConverter implements DataStructureConverter<Integer, Date> {
DateDateConverter();
}
/** Convert time data */
class TimeTimeConverter implements DataStructureConverter<Integer, Time> {
TimeTimeConverter();
}
/** Convert timestamp data */
class TimestampTimestampConverter implements DataStructureConverter<TimestampData, Timestamp> {
TimestampTimestampConverter(int precision);
}Converters for complex data types including raw objects, structured objects, and row data.
/** Convert raw objects */
class RawObjectConverter<T> implements DataStructureConverter<RawValueData<T>, T> {
RawObjectConverter(Class<T> clazz);
}
/** Convert structured objects */
class StructuredObjectConverter<T> implements DataStructureConverter<RowData, T> {
StructuredObjectConverter(Class<T> clazz, LogicalType dataType);
}
/** Convert row data */
class RowRowConverter implements DataStructureConverter<RowData, Row> {
RowRowConverter(LogicalType[] fieldTypes);
}Utilities for efficient manipulation of binary data representations, optimized for high-performance data processing.
/** Utilities for binary row data manipulation */
class BinaryRowDataUtil {
/** Check if two binary rows are equal */
static boolean equals(BinaryRowData row1, BinaryRowData row2);
/** Get hash code for binary row data */
static int hashCode(BinaryRowData row);
/** Copy binary row data */
static BinaryRowData copy(BinaryRowData source);
}
/** Binary string data utilities */
class BinaryStringDataUtil {
/** Create binary string from Java string */
static BinaryStringData fromString(String str);
/** Convert binary string to Java string */
static String toString(BinaryStringData binaryString);
/** Compare two binary strings */
static int compare(BinaryStringData str1, BinaryStringData str2);
}
/** Interface for binary data writing */
interface BinaryWriter {
/** Write binary data */
void writeBytes(byte[] bytes);
/** Complete the write operation */
void complete();
}
/** Wrapper for row data with boxed primitives */
class BoxedWrapperRowData implements RowData {
BoxedWrapperRowData(RowData row);
/** Get field value as boxed primitive */
Object get(int pos);
}Interface for dictionary encoding support, enabling compressed storage and efficient processing of categorical data.
/**
* Interface for dictionary encoding
* Enables compressed storage of categorical data
*/
interface Dictionary {
/** Decode dictionary encoded value */
Object decodeToBinary(int id);
/** Get the size of the dictionary */
int size();
}// Create column vectors
ColumnVector[] vectors = new ColumnVector[3];
vectors[0] = new HeapIntVector(1024);
vectors[1] = new HeapDoubleVector(1024);
vectors[2] = new HeapBytesVector(1024);
// Create a vectorized batch for processing
VectorizedColumnBatch batch = new VectorizedColumnBatch(vectors);
// Write data to the batch
WritableIntVector intCol = (WritableIntVector) batch.columns[0];
WritableDoubleVector doubleCol = (WritableDoubleVector) batch.columns[1];
WritableBytesVector bytesCol = (WritableBytesVector) batch.columns[2];
for (int i = 0; i < 100; i++) {
intCol.setInt(i, i * 10);
doubleCol.setDouble(i, i * 3.14);
bytesCol.setBytes(i, ("value_" + i).getBytes());
}
batch.setNumRows(100);
// Read data from the batch
for (int i = 0; i < batch.getNumRows(); i++) {
int intValue = batch.getInt(i, 0);
double doubleValue = batch.getDouble(i, 1);
String stringValue = batch.getString(i, 2);
}
// Convert between data formats
DataStructureConverter<ArrayData, int[]> arrayConverter =
new ArrayIntArrayConverter();
int[] externalArray = arrayConverter.toExternal(internalArrayData);
ArrayData internalArray = arrayConverter.toInternal(externalArray);Install with Tessl CLI
npx tessl i tessl/maven-org-apache-flink--flink-table-runtime-blink-2-11