LiBinfeng-01 commented on code in PR #23692:
URL: https://github.com/apache/doris/pull/23692#discussion_r1321038535


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PredicatePropagation.java:
##########
@@ -94,16 +94,21 @@ private boolean isDataTypeValid(DataType originDataType, 
Expression expr) {
                                             (IntegralType) 
leftSlotEqualToRightSlot.child(1).getDataType())) {
                         return true;
                     }
+                } else if (leftSlotEqualToRightSlot.child(0).getDataType()
+                        
.equals(leftSlotEqualToRightSlot.child(1).getDataType())) {
+                    return true;
                 }
                 return false;
             }
 
             private Expression replaceSlot(Expression expr, DataType 
originDataType) {
                 return expr.rewriteUp(e -> {
                     if (isDataTypeValid(originDataType, 
leftSlotEqualToRightSlot)) {
-                        if (ExpressionUtils.isTwoExpressionEqualWithCast(e, 
leftSlotEqualToRightSlot.child(0))) {
+                        if (ExpressionUtils.isTwoExpressionEqualWithCast(e, 
leftSlotEqualToRightSlot.child(0))
+                                && !(e instanceof Cast)) {

Review Comment:
   because when rewriteup, it would do rewrite repeatly, assume we have a 
cast(a) = constant,and  a = b for example. When rewrite up, it would replace a 
to b first and then replace cast(b) -> a when go back to cast layer. 
isDatatypeValid parameter has been used.



-- 
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: commits-unsubscr...@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to