seawinde commented on code in PR #29953: URL: https://github.com/apache/doris/pull/29953#discussion_r1453685479
########## fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/StructInfo.java: ########## @@ -216,11 +226,39 @@ public static List<StructInfo> of(Plan originalPlan) { List<HyperGraph> structInfos = HyperGraph.toStructInfo(planSplitContext.getBottomPlan()); return structInfos.stream() - .map(hyperGraph -> new StructInfo(originalPlan, planSplitContext.getTopPlan(), + .map(hyperGraph -> StructInfo.of(originalPlan, planSplitContext.getTopPlan(), planSplitContext.getBottomPlan(), hyperGraph)) .collect(Collectors.toList()); } + /** + * The construct method for init StructInfo + */ + public static StructInfo of(Plan originalPlan, @Nullable Plan topPlan, @Nullable Plan bottomPlan, + HyperGraph hyperGraph) { + ObjectId originalPlanId = originalPlan.getGroupExpression() + .map(GroupExpression::getId).orElseGet(() -> new ObjectId(-1)); + // if any of topPlan or bottomPlan is null, split the top plan to two parts by join node + if (topPlan == null || bottomPlan == null) { + PlanSplitContext planSplitContext = new PlanSplitContext(Sets.newHashSet(LogicalJoin.class)); + originalPlan.accept(PLAN_SPLITTER, planSplitContext); + bottomPlan = planSplitContext.getBottomPlan(); + topPlan = planSplitContext.getTopPlan(); + } + // collect struct info fromGraph + List<CatalogRelation> relations = new ArrayList<>(); + Map<RelationId, StructInfoNode> relationIdStructInfoNodeMap = new HashMap<>(); + Map<Expression, Expression> shuttledHashConjunctsToConjunctsMap = new HashMap<>(); + Map<ExprId, Expression> namedExprIdAndExprMapping = new HashMap<>(); + boolean valid = collectStructInfoFromGraph(hyperGraph, topPlan, shuttledHashConjunctsToConjunctsMap, + namedExprIdAndExprMapping, + relations, + relationIdStructInfoNodeMap); Review Comment: Have fixed it -- 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