morrySnow commented on code in PR #23692:
URL: https://github.com/apache/doris/pull/23692#discussion_r1319323710
##########
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:
why add `!(e instance Cast)` ? add some comment to explain it.
btw, `!(e instance Cast)` is a common predicate, should put at L106.
and `if (isDataTypeValid(originDataType, leftSlotEqualToRightSlot))` could
put before return?
and, we do not use the second parameters at all in `isDataTypeValid` at all
--
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]