Skip to content

Native floating math: track remaining functions and exact-parity compatibility gates #236

Description

@liuyongvs

Verified on PR #220 after rebasing onto merged #222: commit 16ebb1e5a45cc5420abf90473b785d6c0b908a82, released Apache Flink 2.2.1, JDK 17, default compatibility settings. Each probe uses independent stock-Flink and native-enabled environments with bounded runtime DataStream input. Successful comparisons check output values and resolved result types before classifying execution.

Suggested priority: P3. This is a verified native support gap; the successful probes return equal results through explicit Flink fallback.

Lower priority than STRING, exact numeric and temporal coverage. The upstream Scala expression SQL audit contains 106 successful fallback cases in these remaining families. Keep incompatible execution opt-ins disabled during correctness validation.

Runtime probe

Input type:

ROW<`f0` DOUBLE, `f1` INT> NOT NULL

Input: [+I[0.46, 1]]

SELECT truncate(f0, f1) FROM src;

Flink result: [[0.4]]; resolved type: [DOUBLE]. Native substitutions: 0.

Calc: TRUNCATE requires a DECIMAL operand

Runtime probe

Input type:

ROW<`f0` BIGINT> NOT NULL

Input: [+I[44]]

SELECT COSH(f0) FROM src;

Flink result: [[6.4258000571796541E18]]; resolved type: [DOUBLE]. Native substitutions: 0.

Calc: unsupported function/operator: COSH

Runtime probe

Input type:

ROW<`f0` TINYINT> NOT NULL

Input: [+I[42]]

SELECT EXP(f0) FROM src;

Flink result: [[1.73927494152050099E18]]; resolved type: [DOUBLE]. Native substitutions: 0.

Calc: EXP: native result may differ from the host; enable with -Dstreamfusion.expression.EXP.allowIncompatible=true

Unregistered families observed: COSH, SINH, TANH, COT, ATAN2, DEGREES, RADIANS, LOG and LOG2. FLOAT/DOUBLE TRUNCATE still fails the operand gate. Exact-parity compatibility gates remain for EXP, LOG10, LN, SIN, COS, TAN, ASIN, ACOS, ATAN and ROUND. The successful counts include integer operands coerced to floating math; prioritize by resulting semantic contract. This does not reopen the completed POWER/DECIMAL-to-FLOAT scope in #93. Preserve NaN, signed zero, infinities, domain errors and exact deterministic results; enabling allowIncompatible is not completion.

Acceptance

Preserve released Flink values, resolved types, NULL behavior and relevant error/short-circuit semantics. Add runtime-source SQL regressions that assert the specific native operator as well as result parity; do not use constant folding as proof of native support. Keep safe fallback for unverified forms and update the corresponding operator coverage documentation.

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