XieJiann commented on code in PR #30374:
URL: https://github.com/apache/doris/pull/30374#discussion_r1467272758


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/AbstractMaterializedViewRule.java:
##########
@@ -441,6 +441,25 @@ protected SplitPredicate predicatesCompensate(
             viewStructInfo = viewStructInfo.withPredicates(
                     
viewStructInfo.getPredicates().merge(viewPulledUpExpressions));
         }
+        // if the join type in query and mv plan is different, we should check 
query is have the
+        // filters which rejects null
+        Set<Set<Slot>> requireNoNullableViewSlot = 
comparisonResult.getViewNoNullableSlot();
+        // check query is use the null reject slot which view comparison need
+        if (!requireNoNullableViewSlot.isEmpty()) {
+            SlotMapping queryToViewMapping = viewToQuerySlotMapping.inverse();
+            // try to use
+            boolean valid = containsNullRejectSlot(requireNoNullableViewSlot,
+                    queryStructInfo.getPredicates().getPulledUpPredicates(), 
queryToViewMapping, cascadesContext);
+            if (!valid) {
+                queryStructInfo = queryStructInfo.withPredicates(
+                        
queryStructInfo.getPredicates().merge(comparisonResult.getQueryAllPulledUpExpressions()));
+                valid = containsNullRejectSlot(requireNoNullableViewSlot,
+                        
queryStructInfo.getPredicates().getPulledUpPredicates(), queryToViewMapping, 
cascadesContext);
+            }
+            if (!valid) {
+                return SplitPredicate.INVALID_INSTANCE;
+            }

Review Comment:
   ```suggestion
               if (!valid) {
                   queryStructInfo = queryStructInfo.withPredicates(
                           
queryStructInfo.getPredicates().merge(comparisonResult.getQueryAllPulledUpExpressions()));
                   valid = containsNullRejectSlot(requireNoNullableViewSlot,
                           
queryStructInfo.getPredicates().getPulledUpPredicates(), queryToViewMapping, 
cascadesContext);
                   return SplitPredicate.INVALID_INSTANCE;
               }
   ```



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