alamb commented on code in PR #16831:
URL: https://github.com/apache/datafusion/pull/16831#discussion_r2228482416
##########
datafusion/optimizer/src/simplify_expressions/utils.rs:
##########
@@ -168,10 +133,17 @@ pub fn is_one(s: &Expr) -> bool {
Expr::Literal(ScalarValue::Float64(Some(v)), _) if *v == 1. => true,
Expr::Literal(ScalarValue::Decimal128(Some(v), _p, s), _) => {
*s >= 0
- && POWS_OF_TEN
Review Comment:
maybe since we don't have measurements one way or the other to justfy this
change, we revert this change and keep the original approach?
Other than this particular change, this PR looks good to me
##########
datafusion/common/src/scalar/mod.rs:
##########
@@ -1382,6 +1383,38 @@ impl ScalarValue {
DataType::Float16 =>
ScalarValue::Float16(Some(f16::from_f32(1.0))),
DataType::Float32 => ScalarValue::Float32(Some(1.0)),
DataType::Float64 => ScalarValue::Float64(Some(1.0)),
+ DataType::Decimal128(precision, scale) => {
+ if let Err(err) =
validate_decimal_precision_and_scale::<Decimal128Type>(
Review Comment:
What is the reason to add new InternalError wrappers here?
As in why not just
```suggestion
validate_decimal_precision_and_scale::<Decimal128Type>(*precision, *scale)?;
```
--
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]