foxtail463 commented on code in PR #62527:
URL: https://github.com/apache/doris/pull/62527#discussion_r3099165396
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/HyperGraphComparator.java:
##########
@@ -165,7 +165,7 @@ private ComparisonResult isLogicCompatible() {
.forEach(e -> pullUpViewExprWithEdge.put(e,
e.getExpressions()));
Sets.difference(getViewFilterEdgeSet(),
Sets.newHashSet(queryToViewFilterEdge.values()))
.stream()
- .filter(e -> !LongBitmap.isOverlap(e.getReferenceNodes(),
shouldEliminateViewNodesMap))
Review Comment:
> why not use e.getReferenceNodes()
FilterEdge.getReferenceNodes() is the whole filter child subtree, not the
nodes actually referenced by the filter predicate. In HyperGraph.addFilter() we
build the edge with subTreeNodes, so for a filter above t1 LEFT JOIN t2,
getReferenceNodes() contains both sides even if the predicate only uses
preserved-side columns, e.g. WHERE t1.id > 1. Using it here would therefore
over-block safe elimination. getInputNodes() is narrower: it tracks the actual
predicate lineage from input slots (including projected aliases), and only
falls back to the whole subtree for slot-free predicates such as 1 = 0, where
the filter really affects the entire child subtree. That is the dependency we
want for this safety check.
--
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]