2010YOUY01 commented on code in PR #25961:
URL: https://github.com/apache/datafusion/pull/25961#discussion_r4165354653


##########
datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:
##########
@@ -828,6 +828,16 @@ impl<'a> Simplifier<'a> {
     }
 }
 
+fn modulo_one_is_zero_type(data_type: &DataType) -> bool {

Review Comment:
   ```suggestion
   /// Returns whether values of the given type are guaranteed to satisfy 
`value % 1 == 0`.
   fn modulo_one_is_zero_type(data_type: &DataType) -> bool {
   ```



##########
datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:
##########
@@ -828,6 +828,16 @@ impl<'a> Simplifier<'a> {
     }
 }
 
+fn modulo_one_is_zero_type(data_type: &DataType) -> bool {
+    match data_type {
+        DataType::Decimal32(_, scale)
+        | DataType::Decimal64(_, scale)
+        | DataType::Decimal128(_, scale)
+        | DataType::Decimal256(_, scale) => *scale <= 0,
+        data_type => !data_type.is_floating(),

Review Comment:
   Can we expand this `!floating` line to a white list instead? I think this 
bug was originally introduced because it's using a blacklist instead of white 
list.



##########
datafusion/optimizer/src/simplify_expressions/expr_simplifier.rs:
##########
@@ -828,6 +828,16 @@ impl<'a> Simplifier<'a> {
     }
 }
 
+fn modulo_one_is_zero_type(data_type: &DataType) -> bool {
+    match data_type {
+        DataType::Decimal32(_, scale)

Review Comment:
   would be great to add a short comment to explain why it's allowed for 
decimal when scale <= 0, I think this condition is correct.



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

Reply via email to