You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "goutamadwant (via GitHub)" <gi...@apache.org> on 2026/09/15 06:18:10 UTC
[PR] [Fix][Transform-V2] Preserve exact numeric comparisons in SQL predicates [seatunnel]
goutamadwant opened a new pull request, #12318:
URL: https://github.com/apache/seatunnel/pull/12318
<!-- PR title: [Fix][Transform-V2] Preserve exact numeric comparisons in SQL predicates -->
### Purpose of this pull request
Fixes #12317.
Preserve integral and DECIMAL precision in SQL comparisons and numeric IN/NOT IN checks. Integral operands use `Long.compare`; decimal operands reuse `NumericFunction.toBigDecimal` and `BigDecimal.compareTo`. Add regression coverage for comparison operators, membership, CASE expressions and floating-point compatibility.
### Does this PR introduce _any_ user-facing change?
Yes. A BIGINT value of `9007199254740993` no longer matches `WHERE a = 9007199254740992`. Precise DECIMAL comparisons also stop collapsing distinct values through double conversion.
Corrected predicates may select different rows. Review affected predicates and previously written data. FLOAT/DOUBLE and existing NULL behavior remain unchanged. No options, defaults, public APIs, schemas or state formats change. EN/ZH documentation and upgrade notes are included. The defect was verified on unreleased dev; released-version coverage has not been established.
### How was this patch tested?
- All 318 new regression cases pass on Java 8 and Java 11. The suite exposes wrong-result failures against unchanged production code.
- Full transform suite: 1,475 cases passed on each JDK on base `0d9f9e2303da`.
- Root `./mvnw -q -DskipTests verify` and Spotless passed on Java 11 on that base.
- After rebasing onto `f4a9665e8457`, all 486 affected SQL tests and formatting checks passed on Java 8 and Java 11. Production and test changes are unchanged from the broader validation.
- The initial broader Java 8 run hit an unrelated Python executable-path mismatch. Aligning PATH resolved it; all transform tests were rerun. Only an already-passing dependency date/time performance method was omitted from that retry. Java 11 had no exclusions.
- Docker-backed E2E tests were not run.
Focused regression command:
```sh
./mvnw -B -pl seatunnel-transforms-v2 -am package \
-Dtest=SQLNumericComparisonTest -Dsurefire.failIfNoSpecifiedTests=false -Dskip.ui=true
```
### Check list
- [x] No new JAR dependencies or license notices required.
- [x] English and Chinese documentation updated.
- [x] `incompatible-changes.md` updated in both languages.
- [x] Connector checklist not applicable: no connector code, registration, distribution dependencies or plugin configuration changed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Transform-V2] Preserve exact numeric comparisons in SQL predicates [seatunnel]
Posted by "nzw921rx (via GitHub)" <gi...@apache.org>.
nzw921rx merged PR #12318:
URL: https://github.com/apache/seatunnel/pull/12318
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Transform-V2] Preserve exact numeric comparisons in SQL predicates [seatunnel]
Posted by "nzw921rx (via GitHub)" <gi...@apache.org>.
nzw921rx commented on PR #12318:
URL: https://github.com/apache/seatunnel/pull/12318#issuecomment-6437939540
@goutamadwant please rerun failed job?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Transform-V2] Preserve exact numeric comparisons in SQL predicates [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #12318:
URL: https://github.com/apache/seatunnel/pull/12318#issuecomment-5882028049
Following up on the CI item I flagged at the end of my last comment (the fork's `Build` run had moved to failing on `4e93b132bcf`, and I hadn't yet dug into which job or whether it was related to this diff).
I went back and pulled the actual failing jobs on that head: `unit-test (8, windows-latest)`, `engine-v2-it (8, ubuntu-latest)`, `all-connectors-it-6 (11, ubuntu-latest)`, `all-connectors-it-7 (8, ubuntu-latest)`, and `transform-v2-it-part-1 (11, ubuntu-latest)`. I checked the one that's actually in this PR's own module family, `transform-v2-it-part-1`: the real failure there is `org.apache.seatunnel.e2e.transform.TestFilterRowKindIT.testFilterRowKindMultiTable{TestContainer}[3]` — a `FilterRowKind` transform E2E case, unrelated to `ZetaSQLFilter`/`SQLNumericComparisonTest`/the SQL predicate work in this PR. So that failure isn't something this PR introduced.
Since then the branch picked up another routine `dev` sync (`4e93b132bcf` -> `2a6af4939`, `Merge remote-tracking branch 'upstream/dev'`). I diffed the two and it's 44 files, none of them touching `seatunnel-transforms-v2`, `docs/*/transforms/sql.md`, or `docs/*/introduction/concepts/incompatible-changes.md` — so this PR's own content is still byte-identical to what I re-verified against `4e93b132bcf` in my last comment, and my approval stands.
CI on the new head (`2a6af4939`) is only just queued as I write this, so I can't yet confirm it's clean — I'll take one more look once it finishes. No action needed on your side in the meantime.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Transform-V2] Preserve exact numeric comparisons in SQL predicates [seatunnel]
Posted by "goutamadwant (via GitHub)" <gi...@apache.org>.
goutamadwant commented on PR #12318:
URL: https://github.com/apache/seatunnel/pull/12318#issuecomment-6432375928
> ### [P1] Correct the DECIMAL unary-minus documentation
> The documentation states that unary minus on a DECIMAL expression produces DOUBLE and loses exact comparison semantics. This contradicts the current implementation, which uses `BigDecimal.negate()`, and the regression test `comparesNegatedDecimalOperandsExactly`.
>
> Please correct these four locations:
>
> * `docs/en/transforms/sql.md`, lines 50–52
> * `docs/zh/transforms/sql.md`, lines 46–47
> * `docs/en/introduction/concepts/incompatible-changes.md`, lines 252–253
> * `docs/zh/introduction/concepts/incompatible-changes.md`, lines 208–209
>
> The documentation should state that `-decimal_col` and `-CAST('...' AS DECIMAL(p, s))` preserve DECIMAL precision. Also remove the wording that requires a negative sign to be placed inside the quoted string.
>
> Keep the separate warning that fractional numeric literals evaluate as DOUBLE and may already have lost precision before comparison.
>
> Only documentation changes are needed for this finding.
done @nzw921rx pls take a re-look and lmk. thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Transform-V2] Preserve exact numeric comparisons in SQL predicates [seatunnel]
Posted by "SEZ9 (via GitHub)" <gi...@apache.org>.
SEZ9 commented on PR #12318:
URL: https://github.com/apache/seatunnel/pull/12318#issuecomment-5946812232
Nothing new from my side since my last comment: this PR's own content is unchanged across the `4e93b132bcf` -> `2a6af4939` sync and my approval stands.
I haven't yet been able to confirm the CI result on `2a6af4939`. If it has finished on your end, a quick pointer to the outcome would help; otherwise I'll check back once it completes. No action needed from you in the meantime.
<!-- streview-comment:1471 -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Transform-V2] Preserve exact numeric comparisons in SQL predicates [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #12318:
URL: https://github.com/apache/seatunnel/pull/12318#issuecomment-6338447830
Thanks @SEZ9. I checked the questions against unchanged head `42993df4e88c`; several requested cases and notes are already committed:
- **F1/F7:** `docs/en/transforms/sql.md:37-71` explicitly says decimal-point literals evaluate as DOUBLE, gives the rounded-comparison counterexample, documents unary DECIMAL negation, and shows `CAST('...' AS DECIMAL(...))` with the sign inside the string. ZH lines 35-63 mirror this. Each IN operand pair chooses its own path; mixed-type non-transitivity is explicitly preserved rather than solved by changing literal evaluation. Changing all floating/literal semantics would be a separate compatibility decision.
- **F2:** `SQLNumericComparisonTest` has `preservesFloatingComparisonForFractionalLiterals` (160), `comparesExplicitDecimalCastsExactly` (168), `comparesNegativeIntegerLiteralsExactly` (201), `preservesPerElementComparisonForMixedInLists` (208), `comparesNegatedDecimalOperandsExactly` (224), and CAST rounding coverage (242). These are parsed predicates, not just column-versus-column comparisons.
- **F3:** the committed part-2 E2E `sql_transform.conf` declares `large_id` at line 34, uses it in WHERE/NOT IN/CASE at line 58, and asserts it from line 77.
- **F4/F6:** `ZetaSQLFilter.isExactNumber` Javadoc (457-460) states the subtype and floating-operator rules. `compareExactNumbers` (470-478) documents its precondition. All seven production calls are guarded by `areExactNumbers`, including each IN item; an unknown Number subtype cannot reach the Long comparison through those current callers. An extra internal assertion would be defensive hardening, not a demonstrated current truncation path. `areExactNumbers` itself is the simple conjunction at 453-455.
- **F5/F8:** the EN incompatible-changes entry at 159-179 already has Behavior change / Affected component / Description / Impact / Migration Guide. The allocation trade-off is noted beside the helper at 472-473; literal caching is a separate optimization.
I would not ask the author to repeat those changes. This is a targeted answer to the existing points, not another full review. Build is green, but GitHub now reports actual conflicts against dev. Please resolve them and rerun checks on the updated head; I will re-review that full new diff. A write-capable maintainer still owns the final approval/merge decision.
Current status evidence: head `42993df4e88ccb8f481a3a6e96e2de8f3a665f40`, base `dev`, compare `diverged` (ahead 9, behind 48), mergeable state `dirty`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Transform-V2] Preserve exact numeric comparisons in SQL predicates [seatunnel]
Posted by "SEZ9 (via GitHub)" <gi...@apache.org>.
SEZ9 commented on PR #12318:
URL: https://github.com/apache/seatunnel/pull/12318#issuecomment-5771222790
Thanks for the follow-up in `a251a6a3e`. I don't have an independent verification of the earlier points at head `a251a6a3ee37` yet. Could you point to where the follow-up addresses the docs wording for fractional literals, literal-path test coverage (including a `9007199254740992` vs `9007199254740993` style case if one was added), the `compareExactNumbers` guard, the `incompatible-changes.md` entry structure, Javadoc on the numeric-classification helpers, mixed exact/floating semantics in `IN` lists, and the per-row `BigDecimal` allocation? Once I can see those, I'll finish my pass. Nothing else from my side beyond the points raised at `661538a8`.
<!-- streview-comment:1236 -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Transform-V2] Preserve exact numeric comparisons in SQL predicates [seatunnel]
Posted by "nzw921rx (via GitHub)" <gi...@apache.org>.
nzw921rx commented on PR #12318:
URL: https://github.com/apache/seatunnel/pull/12318#issuecomment-6448418148
https://github.com/goutamadwant/seatunnel/actions/runs/40438161814/job/122253724529
`all-connector-it3` deterministic timeout with bypass
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Transform-V2] Preserve exact numeric comparisons in SQL predicates [seatunnel]
Posted by "goutamadwant (via GitHub)" <gi...@apache.org>.
goutamadwant commented on PR #12318:
URL: https://github.com/apache/seatunnel/pull/12318#issuecomment-5748011945
Addressed the follow-up in `a251a6a3e`: EN/ZH docs and compatibility notes now describe evaluated-operand precision, fractional literals, negated DECIMAL expressions, mixed IN lists and CASE. Added six direct-SQL regressions and an exact BIGINT case to the existing E2E fixture.
One correction: STRING/BigDecimal CAST uses CEILING when reducing scale; Float/Double uses HALF_UP. The tests characterize both without changing rounding. The exact helper remains guarded at all seven callers; its precondition, excluded types and allocation tradeoff are documented. I retained native floating comparisons because Double.compare would change NaN/signed-zero behavior, and documented why parser/CASE coverage stays in SQLTransform tests.
Verified 390 focused tests and Spotless. A native-config parse also preserves the E2E value as Long 9007199254740993. Docker E2E execution is still outstanding.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Transform-V2] Preserve exact numeric comparisons in SQL predicates [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #12318:
URL: https://github.com/apache/seatunnel/pull/12318#issuecomment-6109461485
Quick CI update for @goutamadwant. In my last review (head `12d861e23`) the fork `Build` run was still queued, so I had no CI result. It has now finished with `failure`: 77 jobs passed, 6 failed, 11 were skipped. I went through the failed jobs, and none of them look related to this diff.
Everything in this PR's own area is green:
- `SQLNumericComparisonTest` ran 360 tests with 0 failures, and `ZetaSQLFilterTest` passed.
- Both `transform-v2-it-part-1` and `transform-v2-it-part-2` passed on Java 11 and 17.
The 6 failures:
- `elasticsearch-connector-it` (11 and 17): `ElasticsearchIT` slice tests, with "iterable lengths differ" and "contents differ" assertions. This is an index-visibility race. `dev` already has the fix in #12711 (`Poll for index visibility in ElasticsearchIT slice tests`), merged after this branch's last sync.
- `engine-v2-it (17)`: `SplitClusterFaultToleranceIT.testStreamJobCancelResolvesWhenWorkerCrashesBeforeCancelAck`. This is the engine's cancel-vs-worker-loss behavior, not SQL.
- `unit-test (11, ubuntu)`: `CoordinatorServiceJobCleanupTest` failed with "Node failed to start!" in `AbstractSeaTunnelServerTest.before`. This is a Hazelcast startup flake in the engine-server module.
- `engine-k8s-it` (11 and 17): the "install k8s" step failed with "Download failed". This is a CI environment problem, before any test ran.
Suggested next step:
1. Merge the latest `dev` into this branch (it is now 13 commits behind, and the ES fix is in that range).
2. Rerun only the failed jobs. In the Actions run for your fork, use "Re-run failed jobs" rather than rerunning the whole workflow.
My source-side finding from the last review is unchanged: Issue 1, the stale unary-minus-on-DECIMAL wording in the EN/ZH `sql.md` and `incompatible-changes.md`. It is a docs-only change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Transform-V2] Preserve exact numeric comparisons in SQL predicates [seatunnel]
Posted by "goutamadwant (via GitHub)" <gi...@apache.org>.
goutamadwant commented on PR #12318:
URL: https://github.com/apache/seatunnel/pull/12318#issuecomment-5743950218
Merged dev, including the RocketMQ readiness/counting fixes, without changing the SQL comparison patch. All 354 numeric-comparison cases pass in Java 11 reactor verification. Fresh CI is queued.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Transform-V2] Preserve exact numeric comparisons in SQL predicates [seatunnel]
Posted by "SEZ9 (via GitHub)" <gi...@apache.org>.
SEZ9 commented on PR #12318:
URL: https://github.com/apache/seatunnel/pull/12318#issuecomment-6331812711
Thanks for the follow-up. Reading davidzollo's summary of head `42993df4e88c` against the earlier points, I can't confirm the changes from the summary alone, so a few items need confirmation from the author and a few remain open.
**Please confirm (summary suggests these were addressed):**
- **F3 (E2E coverage):** The summary describes `sql_transform.conf` gaining a `large_id` bigint column with value `9007199254740993`, used in `where`/`case` and asserted on. Could you point me to that change? Whether the new unit cases live next to `ZetaSQLFilterTest` or in a new class is a non-blocking preference.
- **F6 (Javadoc on classification helpers):** The summary mentions a comment explaining why Float/Double keep the native operators and that BigInteger is excluded. Please confirm that explanation sits on `isExactNumber` / `areExactNumbers` / `compareExactNumbers` themselves, not only in the user docs.
- **F7 (non-transitivity, per-element `IN` semantics):** The summary says the docs note that transitivity is not guaranteed when exact and floating operands are mixed and that each `IN` element picks its path independently. Please confirm that text is in both EN and ZH `sql.md`. Since this is a behavior concern rather than a docs one, please also say whether you considered any runtime handling, or whether documenting it is the intended resolution.
**Still open:**
- **F1 (decimal literal in the predicate):** A decimal literal parsed as `DoubleValue` would still take the double path while the docs promise exact DECIMAL comparisons. How is a decimal literal classified today? Either make the docs precise about this or handle the literal as `BigDecimal`.
- **F2 (literal test paths):** `SQLNumericComparisonTest` as described covers column-vs-column operands. Please add cases for decimal literal, CAST to DECIMAL, negative literal, and an `IN` list mixing integral and decimal values.
- **F4 (`compareExactNumbers` fallback):** `Long.compare(left.longValue(), right.longValue())` silently truncates if a `Number` subtype not covered by `isExactNumber` ever reaches it. With the guard duplicated at seven call sites, a defensive check (or throwing) inside `compareExactNumbers` would make this hard to regress.
- **F5 (`incompatible-changes.md` format):** Please reshape the entry to match the sibling entries (Behavior change / Affected component / Description / Impact / Migration Guide).
- **F8 (BigDecimal allocation per row):** Low priority; if F1 is addressed by treating literals as `BigDecimal`, caching the constant side would avoid the per-row conversion.
Once F1/F2/F4/F5 are addressed (or you explain why they shouldn't be) and the confirmations above are in, I'm happy to move this forward.
<!-- streview-comment:1943 -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Transform-V2] Preserve exact numeric comparisons in SQL predicates [seatunnel]
Posted by "SEZ9 (via GitHub)" <gi...@apache.org>.
SEZ9 commented on PR #12318:
URL: https://github.com/apache/seatunnel/pull/12318#issuecomment-6119163814
Thanks for the update. On head `12d861e23`, the parts of CI that cover this change are green (`SQLNumericComparisonTest`, `ZetaSQLFilterTest`, and both `transform-v2-it` parts), and the failed jobs look unrelated to this diff. Merging the latest `dev` into the branch and re-running only the failed jobs sounds like the right next step.
On the review side, the one remaining item is the stale unary-minus-on-DECIMAL wording in the EN/ZH `sql.md` and in `incompatible-changes.md`. It is a docs-only change. Once that and the `dev` merge are pushed, ping here and I'll take another look.
<!-- streview-comment:1701 -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Transform-V2] Preserve exact numeric comparisons in SQL predicates [seatunnel]
Posted by "goutamadwant (via GitHub)" <gi...@apache.org>.
goutamadwant commented on PR #12318:
URL: https://github.com/apache/seatunnel/pull/12318#issuecomment-5691736221
Added negative DECIMAL boundary cases in both operand orders across all nine operators. All 522 affected SQL tests pass on Java 8 and Java 11, and root verification passes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Transform-V2] Preserve exact numeric comparisons in SQL predicates [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #12318:
URL: https://github.com/apache/seatunnel/pull/12318#issuecomment-5787066487
@/tmp/reply_body_12318.md
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Fix][Transform-V2] Preserve exact numeric comparisons in SQL predicates [seatunnel]
Posted by "DanielLeens (via GitHub)" <gi...@apache.org>.
DanielLeens commented on PR #12318:
URL: https://github.com/apache/seatunnel/pull/12318#issuecomment-6266774417
The CI fact cited in my previous review has changed: Build for the current unchanged head is now passing. CI was previously the only remaining blocker; CI is now passing, so my technical conclusion changes to approve. I do not see a new source-side blocker from Daniel's review. This branch is behind the latest dev base, which I have recorded as merge metadata only; because the current head CI is green, that fact alone does not call for an additional source change. I have read-only review controls, so this COMMENT does not change GitHub's displayed review decision; a write-capable maintainer must perform any final approval or dismissal action.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org