morningman commented on a change in pull request #2821: The new materialized view selector URL: https://github.com/apache/incubator-doris/pull/2821#discussion_r370971774
########## File path: fe/src/main/java/org/apache/doris/planner/OlapScanNode.java ########## @@ -497,4 +571,107 @@ public static OlapScanNode createOlapScanNodeByLocation( return olapScanNode; } + + public void collectColumns(Analyzer analyzer, Set<String> equivalenceColumns, Set<String> unequivalenceColumns) { + // 1. Get columns which has predicate on it. + for (Expr expr : conjuncts) { + if (!isPredicateUsedForPrefixIndex(expr, false)) { + continue; + } + for (SlotDescriptor slot : desc.getMaterializedSlots()) { + if (expr.isBound(slot.getId())) { + if (!isEquivalenceExpr(expr)) { + unequivalenceColumns.add(slot.getColumn().getName()); + } else { + equivalenceColumns.add(slot.getColumn().getName()); + } + break; + } + } + } + + // 2. Equal join predicates when pushing inner child. + List<Expr> eqJoinPredicate = analyzer.getEqJoinConjuncts(desc.getId()); + for (Expr expr : eqJoinPredicate) { + if (!isPredicateUsedForPrefixIndex(expr, true)) { + continue; + } + for (SlotDescriptor slot : desc.getMaterializedSlots()) { + for (int i = 0; i < 2; i++) { Review comment: getChildren.size() is better for code reading. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org