junjunjd commented on code in PR #7901:
URL: https://github.com/apache/arrow-datafusion/pull/7901#discussion_r1381197592


##########
datafusion/common/src/scalar.rs:
##########
@@ -1834,30 +1883,31 @@ impl ScalarValue {
                 }
 
                 let arr = Decimal128Array::from(vals)
-                    .with_precision_and_scale(*precision, *scale)
-                    .unwrap();

Review Comment:
   Similar to previous 
[comment](https://github.com/apache/arrow-datafusion/pull/7901/files#r1381174929),
 this error is reachable because 
[ScalarValue::try_new_decimal128](https://github.com/apache/arrow-datafusion/blob/main/datafusion/common/src/scalar.rs#L660-L661)
 allows a decimal with precision 0, while 
[arrow-array](https://github.com/apache/arrow-rs/blob/master/arrow-array/src/types.rs#L1234-L1235)
 does not support that.
   We can update `try_new_decimal128` to disallow decimal with precision 0 or 
establish an invariant here so this error becomes unreachable and we can panic 
here.



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