Contains classes required by TaskManagers for execution of table programs. Implements runtime operators, built-in functions, and code generation support. Bundles janino (Java compiler for code generation) and flink-shaded-jsonpath.
functions/scalar/— Scalar function implementations (47+)functions/aggregate/— Aggregate function implementationsfunctions/table/— Table function implementationsfunctions/ptf/— Process table function implementationsfunctions/ml/— Machine learning function implementationsoperators/— Runtime operators organized by type:join/(hash, sort-merge, lookup, temporal, interval, delta, adaptive, stream/multi-join)aggregate/(group, window)window/(TVF windows, group windows)deduplicate/,rank/,sort/sink/,source/correlate/(includingasync/for async table functions)calc/,match/,over/,process/,ml/,search/
Base classes by function type:
- Scalar: Extend
BuiltInScalarFunctioninfunctions/scalar/ - Table: Extend
BuiltInTableFunctioninfunctions/table/ - Aggregate: Extend
BuiltInAggregateFunctioninfunctions/aggregate/ - Process Table Function: Extend
BuiltInProcessTableFunctioninfunctions/ptf/
All are constructed from BuiltInFunctionDefinition#specialize(SpecializedContext) and work on internal data structures by default.
Some functions also require custom code generators in the planner (e.g., JsonCallGen.scala for JSON functions). Simple scalar functions typically don't need planner changes; the planner handles them uniformly through the function definition.
- 1 or 2 inputs: Extend
TableStreamOperator<RowData>(which extendsAbstractStreamOperator<OUT>) and implementOneInputStreamOperator<RowData, RowData>orTwoInputStreamOperator<RowData, RowData, RowData> - 3+ inputs: Extend
AbstractStreamOperatorV2and implementMultipleInputStreamOperator(seeStreamingMultiJoinOperator) TableStreamOperatorprovides watermark tracking (currentWatermark), memory size computation, and aContextImplfor timer services
- Key-ordered async execution:
operators/join/lookup/keyordered/contains async execution controller infrastructure (AecRecord,Epoch,EpochManager,KeyAccountingUnit,RecordsBuffer) for ordering guarantees in async lookup joins - Async correlate:
operators/correlate/async/for async table function support - Runner abstraction:
AbstractFunctionRunnerandAbstractAsyncFunctionRunnerprovide base classes for code-generated function invocations (used by lookup join, ML predict, vector search runners)
- When modifying state serializers, create a
TypeSerializerSnapshotwith version bumping - Migration test resources follow naming:
migration-flink-<version>-<backend>-<variant>-snapshot - Rescaling tests verify state redistribution across parallelism changes (see
SinkUpsertMaterializerMigrationTest,SinkUpsertMaterializerRescalingTest)
- Harness tests: Use
OneInputStreamOperatorTestHarness<RowData, RowData>withRowDataHarnessAssertorfor output validation. Seeoperators/join/LookupJoinHarnessTest.javaas a reference. - Test utilities:
StreamRecordUtils.insertRecord()for test records,RowDataHarnessAssertorfor assertions - Operator test base classes: Module has dedicated base classes per operator type (e.g.,
TemporalTimeJoinOperatorTestBase,Int2HashJoinOperatorTestBase,WindowAggOperatorTestBase) - State migration tests: Use snapshot files per Flink version and state backend type to verify forward/backward compatibility