goutamadwant opened a new pull request, #12364:
URL: https://github.com/apache/seatunnel/pull/12364
### Purpose of this pull request
Fixes #12362.
Fix silent precision loss in ARRAY_MAX/MIN by selecting a comparator for the
complete input array: exact long comparisons for integral wrappers, BigDecimal
comparisons for decimals, and the existing double comparator for floating-point
or mixed representations. No dependency on other pending SQL fixes.
### Does this PR introduce _any_ user-facing change?
Yes. On the validated dev baseline, maximum of `[9007199254740992,
9007199254740993]` can return the smaller value. Distinct DECIMAL values can
have the same problem. Both extrema now select the correct original element.
No configuration, public API, declared output-type or checkpoint-format
changes. Corrected output may differ from the previous rounded result. Selected
DECIMAL elements are not rescaled; selecting a different original element can
also select its different scale. Existing ties, nulls, string comparisons,
floating-point special values and mixed-category ordering are preserved. EN/ZH
documentation and compatibility notes are updated.
### How was this patch tested?
- Reproduced baseline failures on Java 8 and Java 11 before applying the
production fix.
- Extended existing ArrayFunctionTest and SQLNumericFunctionsTest:
positive/negative large integers, decimal precision/range, reversed inputs,
stable ties, wrappers, nulls and floating-point/mixed cases.
- Full transform suites passed on Java 8u172 and Java 11.0.19: 1,164 tests
each, zero failures/errors/skips.
- Extended the existing TestSQLIT array-extrema fixture with BIGINT and
DECIMAL coverage. The final fixture passed against a fresh distribution on Zeta
Java 8/11 and Spark 3.3 / Java 8. An unchanged-transform Zeta negative control
failed as expected.
- Spotless passed. A combined integration tree containing this fix and the
separate Replace rebinding fix passed the 310-module Java 11 `verify
-DskipTests -Dskip.ui=true` build. Repository-wide test execution and every
engine/version combination are not claimed.
Focused reproduction/test command, with the selected JDK in JAVA_HOME:
```sh
./mvnw -B -pl seatunnel-transforms-v2 -am package \
-Dtest=ArrayFunctionTest,SQLNumericFunctionsTest \
-Dsurefire.failIfNoSpecifiedTests=false -Dskip.ui=true
```
### Check list
- [x] Regression coverage added to existing unit and E2E tests.
- [x] EN/ZH function documentation updated.
- [x] EN/ZH incompatible-change notes updated.
- No new JAR dependencies or connector registration changes.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]