github-actions[bot] commented on code in PR #61176:
URL: https://github.com/apache/doris/pull/61176#discussion_r3077133081
##########
fe/fe-core/src/main/java/org/apache/doris/persist/EditLog.java:
##########
@@ -1211,6 +1212,7 @@ public static void loadJournal(Env env, Long logId,
JournalEntity journal) {
}
env.getConstraintManager().addConstraint(
tni, constraint.getName(), constraint, true);
+
MTMVUtil.invalidateDependentMtmvCachesForConstraint(tni, constraint);
Review Comment:
This invalidation now runs after the constraint mutation but inside the same
broad `catch`. If `invalidateDependentMtmvCachesForConstraint()` throws for one
dependent MV during replay, the constraint add/drop has already been applied
and replay only logs a warning.
That leaves follower/checkpoint FE with updated constraint metadata but
stale MTMV rewrite caches, which is not replay-equivalent to the master path.
Please avoid swallowing this partial-failure state here: either make
invalidation best-effort per dependent MV without aborting the rest, or surface
the replay failure instead of warning-and-continuing.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/HyperGraphComparator.java:
##########
@@ -254,21 +254,26 @@ private boolean canEliminateViewEdge(JoinEdge joinEdge) {
}
private boolean tryEliminateNodesAndEdge() {
- boolean hasFilterEdgeAbove = viewHyperGraph.getFilterEdges().stream()
- .filter(e -> LongBitmap.getCardinality(e.getReferenceNodes())
== 1)
- .anyMatch(e -> LongBitmap.isSubset(e.getReferenceNodes(),
shouldEliminateViewNodesMap));
- if (hasFilterEdgeAbove) {
- // If there is some filter edge above the eliminated node, we
should rebuild a plan
- // Right now, just reject it.
- return false;
- }
long allCanEliminateNodes = 0;
for (JoinEdge joinEdge : viewHyperGraph.getJoinEdges()) {
long canEliminateSideNodes = getCanEliminateSideNodes(joinEdge);
allCanEliminateNodes = LongBitmap.or(allCanEliminateNodes,
canEliminateSideNodes);
- if (LongBitmap.isOverlap(canEliminateSideNodes,
reservedShouldEliminatedViewNodes)
- && !canEliminateViewEdge(joinEdge)) {
- return false;
+ long shouldEliminateNodesOnCurrentEdge =
+ LongBitmap.newBitmapIntersect(canEliminateSideNodes,
reservedShouldEliminatedViewNodes);
+ if (LongBitmap.isOverlap(canEliminateSideNodes,
reservedShouldEliminatedViewNodes)) {
+ boolean hasFilterEdgeOnCurrentEliminatedNode =
Review Comment:
`hasFilterEdgeOnCurrentEliminatedNode` only looks at single-node filter
edges, but the rewrite is still unsafe when the eliminated inner-join side
participates in a residual filter that also references a retained node.
Concrete case: a view like `T1 INNER JOIN T2 ON ... WHERE T1.k = T2.k2` can
still eliminate `T2` here if PK/FK says the join is removable. Later in
`compareExpr`, residual view filter edges that overlap
`shouldEliminateViewNodesMap` are skipped entirely, so that extra predicate is
lost instead of being validated for pull-up. This makes the view look
equivalent to `SELECT ... FROM T1` when it is not.
Please keep rejecting INNER JOIN elimination whenever any non-inferred
residual filter still references the eliminated node, not just single-node
filters.
--
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]