fatmanverse commented on PR #12920:
URL: https://github.com/apache/seatunnel/pull/12920#issuecomment-6309091285

   Thanks @DanielLeens for the review. Issue 1 is addressed in 7c4b22e. One 
part differs from the suggestion, and I explain why below.
   
   - **COALESCE / IFNULL:** the `incompatible-changes.md` entry (en/zh) now 
says that the same rounding applies when `COALESCE` or `IFNULL` converts its 
result to the inferred DECIMAL type. It includes an example: when `dec2_col` is 
`DECIMAL(20,2)` and NULL, `COALESCE(dec2_col, dec4_col)` on `1.2345` gave 
`1.24` and now gives `1.23`. Impact and Migration mention both functions. The 
`CAST` note in `sql-functions.md` (en/zh) has one more sentence on them. New 
`testCoalesceAndIfNullRoundInferredDecimalLikeCast` runs that example through 
the SQL engine (`1.2345 -> 1.23` for COALESCE, `-1.2350 -> -1.24` for IFNULL). 
Both assertions fail with the old CEILING.
   - **CASE:** this goes through the same `castAs` branch, as you traced, but I 
did not list it next to COALESCE and IFNULL in Impact. 
`ZetaSQLType#getCaseType` takes `getMaxType` over the branches, so the result 
scale is the largest branch scale. A branch that matches its declared type is 
therefore only widened and never loses digits. Mixing STRING with DECIMAL 
branches is rejected as `type not compatible`, and FLOAT or DOUBLE branches 
already used HALF_UP. Rounding can only happen when a value has more decimal 
places than its declared column type, and the Description says so in one 
sentence instead of presenting CASE as a common case. If you would rather list 
it with the other two anyway, I am happy to change it.
   
   Verified on JDK 17: `SystemFunctionTest` (25 tests) passes, and spotless is 
clean.
   
   The current red `Build` is from `dev`: `unit-test` fails in 
`LLMBooleanOutputTest.readsLegacyFactoryWrapperWithValidationDisabled` 
(#12929), and `engine-v2-it` fails in `BackpressureSlowSinkIT`, which also 
fails on `dev`. I will re-run the failed jobs once `dev` is fixed.
   


-- 
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]

Reply via email to