seawinde commented on code in PR #29609:
URL: https://github.com/apache/doris/pull/29609#discussion_r1444243895
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/AbstractMaterializedViewRule.java:
##########
@@ -383,30 +396,87 @@ protected Expression rewriteExpression(Expression
sourceExpressionsToWrite, Plan
* For another example as following:
* predicate a = b in mv, and a = b and c = d in query, the compensatory
predicate is c = d
*/
- protected SplitPredicate predicatesCompensate(StructInfo queryStructInfo,
StructInfo viewStructInfo,
- SlotMapping queryToViewSlotMapping) {
+ protected SplitPredicate predicatesCompensate(
+ StructInfo queryStructInfo,
+ StructInfo viewStructInfo,
+ SlotMapping queryToViewSlotMapping,
+ ComparisonResult comparisonResult,
+ CascadesContext cascadesContext
+ ) {
+ // viewEquivalenceClass to query based
+ SlotMapping viewToQuerySlotMapping = queryToViewSlotMapping.inverse();
+ final Set<Expression> equalCompensateConjunctions =
compensateEquivalence(
+ queryStructInfo,
+ viewStructInfo,
+ viewToQuerySlotMapping,
+ comparisonResult);
+ // range compensate
+ final Set<Expression> rangeCompensatePredicates =
compensateRangePredicate(
+ queryStructInfo,
+ viewStructInfo,
+ viewToQuerySlotMapping,
+ comparisonResult);
+ // residual compensate
+ final Set<Expression> residualCompensatePredicates =
compensateResidualPredicate(
+ queryStructInfo,
+ viewStructInfo,
+ viewToQuerySlotMapping,
+ comparisonResult);
+ // if the join type in query and mv plan is different, we should check
and add filter on mv to make
+ // the mv join type is accord with query
+ Set<Set<Slot>> viewNoNullableSlot =
comparisonResult.getViewNoNullableSlot();
Review Comment:
OK, it's better
--
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]