fatmanverse commented on PR #12920:
URL: https://github.com/apache/seatunnel/pull/12920#issuecomment-6413059397
Thanks @zhengxiang378928908-code for the comparison, and @DanielLeens for
the concrete steps. Done in 8884540, code behaviour unchanged:
1. `incompatible-changes.md` (en/zh): dropped "like `CAST` in MySQL,
PostgreSQL and H2". It now says every source type rounds half away from zero,
that FLOAT and DOUBLE are still converted from their exact binary value first,
and that near a rounding boundary they can therefore differ from the same
digits as STRING or DECIMAL and from a database `CAST`, with `CAST(1.15 AS
DECIMAL(10,1))` = `1.2` for STRING/DECIMAL and `1.1` for DOUBLE as the example.
2. Narrowed the comment above `setScale(scale, RoundingMode.HALF_UP)` in
`SystemFunction` and the two `SystemFunctionTest` comments: the source-type
equivalence is now stated only for the values those tests use, which are not
near a boundary in binary.
3. New
`SystemFunctionTest#testCastAsDecimalRoundsDoubleFromItsExactBinaryValue`:
`1.15d` and `-1.15d` at scale 1 give `1.1` / `-1.1` while `"1.15"` and
`BigDecimal("1.15")` give `1.2`, and `2.675d` at scale 2 gives `2.67` while
`"2.675"` gives `2.68`. I checked the exact binary values and the `HALF_UP`
results on JDK 11 before writing the assertions.
The DOUBLE conversion itself is left as it is, as you both suggested.
Also merged the latest `dev` (b8406b1, conflict resolution only: kept both
the new `dev` entries and this PR's entry at the top of
`incompatible-changes.md` en/zh). On JDK 17, `./mvnw -pl
seatunnel-transforms-v2 test` passes: 1493 tests, 0 failures (18 skipped),
`SystemFunctionTest` 26/26.
--
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]