voonhous commented on code in PR #20457:
URL: https://github.com/apache/hudi/pull/20457#discussion_r4462938612
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/BaseHoodieCatalystExpressionUtils.scala:
##########
@@ -81,11 +81,13 @@ abstract class BaseHoodieCatalystExpressionUtils extends
HoodieCatalystExpressio
// Math Expressions
// Binary
- case Add(OrderPreservingTransformation(attrRef), _, _) => Some(attrRef)
- case Add(_, OrderPreservingTransformation(attrRef), _) => Some(attrRef)
- case Multiply(OrderPreservingTransformation(attrRef), _, _) =>
Some(attrRef)
- case Multiply(_, OrderPreservingTransformation(attrRef), _) =>
Some(attrRef)
- case Divide(OrderPreservingTransformation(attrRef), _, _) =>
Some(attrRef)
+ // NOTE: The other operand must not reference the column, or it could
reverse the
+ // ordering (for ex, A + A * -2 = -A)
+ case Add(OrderPreservingTransformation(attrRef), other, _) if
other.references.isEmpty => Some(attrRef)
+ case Add(other, OrderPreservingTransformation(attrRef), _) if
other.references.isEmpty => Some(attrRef)
+ case Multiply(OrderPreservingTransformation(attrRef), factor, _) if
isPositiveNumericLiteral(factor) => Some(attrRef)
+ case Multiply(factor, OrderPreservingTransformation(attrRef), _) if
isPositiveNumericLiteral(factor) => Some(attrRef)
+ case Divide(OrderPreservingTransformation(attrRef), divisor, _) if
isPositiveNumericLiteral(divisor) => Some(attrRef)
case BitwiseOr(OrderPreservingTransformation(attrRef), _) =>
Some(attrRef)
Review Comment:
This is already tracked in the #20449 plan as its own mechanism (oracle
family `bitwise_or`). Keeping it out of this PR so each PR closes one failure
mechanism; it gets its own fix after this one.
--
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]