morrySnow commented on code in PR #34781: URL: https://github.com/apache/doris/pull/34781#discussion_r1616811767
########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/MaterializedViewUtils.java: ########## @@ -95,17 +97,31 @@ public static Optional<RelatedTableInfo> getRelatedTableInfo(String column, Plan if (!columnSlot.isColumnFromTable()) { return Optional.empty(); } - // check sql pattern - IncrementCheckerContext context = new IncrementCheckerContext(columnSlot); - materializedViewPlan.accept(MaterializedViewIncrementChecker.INSTANCE, context); - if (context.getPartitionRelatedTableAndColumnList().isEmpty() || !context.isPctPossible()) { + // Collect table relation map which is used to identify self join + List<Object> catalogRelationObjs = materializedViewPlan.collectToList( + planTreeNode -> planTreeNode instanceof CatalogRelation); + ImmutableMultimap.Builder<TableIdentifier, CatalogRelation> tableCatalogRelationMultimapBuilder = + ImmutableMultimap.builder(); Review Comment: use expectedSize builder ########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/MaterializedViewUtils.java: ########## @@ -95,17 +97,31 @@ public static Optional<RelatedTableInfo> getRelatedTableInfo(String column, Plan if (!columnSlot.isColumnFromTable()) { return Optional.empty(); } - // check sql pattern - IncrementCheckerContext context = new IncrementCheckerContext(columnSlot); - materializedViewPlan.accept(MaterializedViewIncrementChecker.INSTANCE, context); - if (context.getPartitionRelatedTableAndColumnList().isEmpty() || !context.isPctPossible()) { + // Collect table relation map which is used to identify self join + List<Object> catalogRelationObjs = materializedViewPlan.collectToList( + planTreeNode -> planTreeNode instanceof CatalogRelation); Review Comment: ```suggestion List<CatalogRelation> catalogRelationObjs = materializedViewPlan.<CatalogRelation>collectToList(CatalogRelation.class::isInstance); ``` -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org