isidentical commented on code in PR #3782:
URL: https://github.com/apache/arrow-datafusion/pull/3782#discussion_r992844418


##########
datafusion/optimizer/src/simplify_expressions.rs:
##########
@@ -137,6 +179,9 @@ fn is_one(s: &Expr) -> bool {
         | Expr::Literal(ScalarValue::UInt64(Some(1))) => true,
         Expr::Literal(ScalarValue::Float32(Some(v))) if *v == 1. => true,
         Expr::Literal(ScalarValue::Float64(Some(v))) if *v == 1. => true,
+        Expr::Literal(ScalarValue::Decimal128(Some(v), _p, _s)) => {
+            *_s < DECIMAL128_MAX_PRECISION && POWS_OF_TEN[*_s as usize] == *v

Review Comment:
   Question: Is there a specific reason to embed a `POWS_OF_TEN` array instead 
of dynamically calculating it at the runtime? (or the same goes to taking to 
`log10()` of the `v`, instead of raising `_s`) E.g.
   
   ```rust
   i128::pow(10, *_s as u32) == *v
   ``` 



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to