Skip to content

Track main correctness fixes for CAST initialization, day-time intervals, and FORCE join validation (PR #30) #84

Description

@liuyongvs

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:

1234.567
9876.543

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:

  1. 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.
  2. 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

  • Valid non-nullable CAST queries initialize successfully and match stock Flink; add nullable/non-nullable regression coverage without swallowing real cast-initialization errors.
  • Supported day-time interval projections, keys, filters and join residuals preserve Flink semantics, with explicit planning-time fallback for unsupported combinations.
  • FORCE delta-join validation errors remain observable as they are in stock Flink.
  • Relevant regression tests and coverage documentation are included in the main-branch fix.
  • Link the shipping fix to this issue and verify the reproduced CAST case on the merged main revision.

Proposed implementation: #30.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions