SEPURI-SAI-KRISHNA commented on PR #12182: URL: https://github.com/apache/seatunnel/pull/12182#issuecomment-5758386356
Thanks @SEZ9, all three are right and all three are addressed in the push above. **Issue 1.** You were right that the inputs never reached the boundary. `300 % -128` is 44 and `100000 % -32768` is 1696, so those assertions only proved the divisor-type branch was dispatched, which the `(byte) 1` cases above already did. Replaced with the four extremes you named, `MOD(±127, Byte.MIN_VALUE)` and `MOD(±32767, Short.MIN_VALUE)`, which also gives the narrow types their first negative-dividend coverage. I checked your failure scenario directly rather than taking it on reasoning. Adding the exact guard you described, `abs(remainder) >= Byte.MAX_VALUE`, to the byte branch: with the old assertions all 29 tests still pass, and with the new ones it fails. That is your point reproduced. **Issue 3.** Agreed, "always fits" conflated range with precision. The comment now says the remainder is within the divisor's range but that a FLOAT, DOUBLE or DECIMAL dividend keeps its fraction and `byteValue()` truncates it, that this is deliberate, and that it should not be turned into rounding or a wider return type. Pinned with `MOD(5.5d, (byte) 2) == (byte) 1`; mutating the branch to round instead fails it. **Issue 2.** Taken, but via your second option rather than the first. You offered either folding the planner-side assertion into the #12215 test or trimming this one to the `typeMapping()` assertions and pointing at the sibling in the Javadoc. I took the second, because #12364 is currently open and adds 50 lines to `SQLNumericFunctionsTest.java`, so editing that file now would collide with it for no benefit. The duplicated value assertions are gone and the Javadoc names the sibling test. 1158 tests pass in `seatunnel-transforms-v2`, `verify` is clean on JDK 11, and a forced `spotless:check` passes. `NumericFunction.java` is still byte-identical to `dev` once comments are stripped. -- 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]
