0lai0 commented on code in PR #5050:
URL: https://github.com/apache/datafusion-comet/pull/5050#discussion_r4307635672
##########
native/core/src/execution/planner.rs:
##########
@@ -1511,14 +1511,20 @@ impl PhysicalPlanner {
left.data_type(&input_schema),
right.data_type(&input_schema),
) {
+ // The width test is done in `i16` rather than `u8`: a negative
scale makes
+ // `s as u8` wrap to a huge value and `p - s as u8` underflow,
which panics in debug
+ // builds and silently selects the wrong branch in release
(`overflow-checks = false`).
+ // Precision and scale are both bounded well inside `i16`, so this
cannot overflow.
Review Comment:
Thanks for checking that and walking it back rather than leaving it. I had
written "silently selects the wrong branch in release" as an inference and
never verified it, so that one is on me.
Corrected in the doc comment on `decimal128_add_sub_width`, which both call
sites now point at, in the note on `negScaleDecimalRejection` and in the PR
description. They now say a debug build panicked and a release build was
unaffected.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]