Problem and related PR
Tracking issue for the main-branch correctness fixes proposed in #30 (still open and unmerged when this issue was created). These problems belong on main independently of the Flink 2.1.3 backport. This issue provides a place to track the defects, regression evidence, and completion of that PR's scope.
Independently reproduced: non-nullable CAST initialization
Confirmed on main ebe550c69122909cd08fca8ee89380478a92cc5c, released Apache Flink 2.2.1, JDK 17, UTC, default compatibility settings.
Use a bounded runtime source with schema s CHAR(8) NOT NULL and these valid, non-null values:
Run the same query in two fresh streaming TableEnvironments, first on stock Flink and then with NativePlanner.install(tableEnvironment):
SELECT CAST(s AS DOUBLE) AS cast_value FROM input_table;
The source must supply runtime rows rather than a directly folded constant expression. The audited query routes through NativeCalc, with one actual native substitution.
Expected: both engines return 1234.567 and 9876.543.
Observed on stock Flink: both rows are returned successfully.
Observed on native execution: the job fails during function initialization, before the valid input values can be evaluated:
IllegalStateException: failed to open UDF tech.streamfusion.planner.HostCastFunction
TableRuntimeException: Error when casting CHAR(8) NOT NULL to DOUBLE NOT NULL.
NullPointerException: Cannot invoke "org.apache.flink.table.data.binary.BinaryStringData.trim()"
because "<local2>" is null
HostCastFunction.initializeExecutor() warms the generated cast by calling executor.cast(null) repeatedly, even when the input type is non-nullable. A valid non-null warmup value is required for those generated executors. This is an initialization failure for valid input, not malformed-input behavior.
Remaining scope described by PR #30
The following two areas are included in the existing PR's report and proposed changes; the independent audit evidence above specifically reconfirms the CAST defect:
- Day-time interval output and predicates: preserve the millisecond representation when interval expressions pass through native operators; reject unsupported interval filter/join predicates at planning time so they fall back rather than fail during execution. Duration and year-month interval gaps should remain explicitly documented.
- FORCE join validation: preserve stock Flink's validation failure under
table.optimizer.delta-join.strategy=FORCE; native substitution must not hide an error that Flink is supposed to raise. This does not require adding native delta-join support.
Acceptance criteria
Proposed implementation: #30.
Problem and related PR
Tracking issue for the main-branch correctness fixes proposed in #30 (still open and unmerged when this issue was created). These problems belong on main independently of the Flink 2.1.3 backport. This issue provides a place to track the defects, regression evidence, and completion of that PR's scope.
Independently reproduced: non-nullable CAST initialization
Confirmed on main
ebe550c69122909cd08fca8ee89380478a92cc5c, released Apache Flink 2.2.1, JDK 17, UTC, default compatibility settings.Use a bounded runtime source with schema
s CHAR(8) NOT NULLand these valid, non-null values:Run the same query in two fresh streaming TableEnvironments, first on stock Flink and then with
NativePlanner.install(tableEnvironment):The source must supply runtime rows rather than a directly folded constant expression. The audited query routes through
NativeCalc, with one actual native substitution.Expected: both engines return
1234.567and9876.543.Observed on stock Flink: both rows are returned successfully.
Observed on native execution: the job fails during function initialization, before the valid input values can be evaluated:
HostCastFunction.initializeExecutor()warms the generated cast by callingexecutor.cast(null)repeatedly, even when the input type is non-nullable. A valid non-null warmup value is required for those generated executors. This is an initialization failure for valid input, not malformed-input behavior.Remaining scope described by PR #30
The following two areas are included in the existing PR's report and proposed changes; the independent audit evidence above specifically reconfirms the CAST defect:
table.optimizer.delta-join.strategy=FORCE; native substitution must not hide an error that Flink is supposed to raise. This does not require adding native delta-join support.Acceptance criteria
Proposed implementation: #30.