Skip to content

[FLINK-40693][table] Align floating-point IN predicates with equality for signed zero - #29221

Open
ParyshevSergey wants to merge 1 commit into
apache:masterfrom
ParyshevSergey:dev/sql_in_op_float
Open

ParyshevSergey wants to merge 1 commit into
apache:masterfrom
ParyshevSergey:dev/sql_in_op_float

Conversation

@ParyshevSergey

Copy link
Copy Markdown
Contributor

What is the purpose of the change

FLOAT/DOUBLE equality accepts opposite signed zeros, but constant-list IN/NOT IN implemented through SEARCH can reject them because the underlying hash sets use boxed equality. For example, typed runtime rows with IDs [1, 1, 2] and
values [-0.0, -0.0, +0.0] produce [2] for IN (0, 2), while equality produces [1, 1, 2].

This change makes floating-point SEARCH membership consistent with existing numeric equality for signed zero.

Brief change log

  • Include both zero representations when preparing a SEARCH constant set containing either zero, after casting to the common type.
  • Preserve both representations during code generation.
  • Add compiled codegen regressions and SQL integration tests for FLOAT/DOUBLE in batch and streaming.

The general hash-set contracts, generated per-row lookup and NULL handling remain unchanged. Existing NaN behavior is preserved.

Verifying this change

  • Verified red → green: 6 assertion failures among 10 new test invocations before the fix; all 10 pass afterward.
  • SearchOperatorGenTest covers both zero directions, IN/NOT IN paths, NULL handling, nonzero values, NaN and infinities.
  • FloatingPointInITCase verifies runtime raw bits, logical types, generated hash-set code, duplicate rows, singleton and longer lists, and nullable boolean results.
  • Targeted unit run: 45 passing invocations across SearchOperatorGenTest, ScalarOperatorsTest, CodeGeneratorContextTest and ConvertToNotInOrInRuleTest.
  • Targeted integration run: 46 passing invocations across FloatingPointInITCase and ComparisonFunctionITCase, with JUnit parallel execution disabled for the final run.
  • Spotless, Checkstyle, root Apache RAT and git diff --check pass.

Tests used the freshly built runtime artifact. Full CI and release-branch backports were not run.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): yes, SEARCH membership results change; implementation changes are confined to preparing the reusable set, with no additional per-record operations or allocations
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable
  • Release-note draft: FLOAT and DOUBLE constant-list IN/NOT IN now treat opposite signed zeros as equal, consistently with numeric equality.

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Codex (model: GPT-6 Astra; client version not exposed)

@flinkbot

flinkbot commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants