From 03af1086c0bf106b0de694f2246a296ecc0ad51b Mon Sep 17 00:00:00 2001 From: seawinde Date: Mon, 4 Dec 2023 08:11:09 +0800 Subject: [PATCH] tmp modify some comments --- .../rules/exploration/mv/Predicates.java | 42 +++++++++---------- .../exploration/mv/PredicatesSplitter.java | 13 +++--- .../mv/mapping/RelationMapping.java | 13 +++--- 3 files changed, 35 insertions(+), 33 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/Predicates.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/Predicates.java index d91100e16c9af9..43aab2389caf50 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/Predicates.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/Predicates.java @@ -62,26 +62,26 @@ public static SplitPredicate splitPredicates(Expression expression) { * The split different representation for predicate expression, such as equal, range and residual predicate. * */ public static final class SplitPredicate { - private final Expression equalPredicates; - private final Expression rangePredicates; - private final Expression residualPredicates; - - public SplitPredicate(Expression equalPredicates, Expression rangePredicates, Expression residualPredicates) { - this.equalPredicates = equalPredicates; - this.rangePredicates = rangePredicates; - this.residualPredicates = residualPredicates; + private final Expression equalPredicate; + private final Expression rangePredicate; + private final Expression residualPredicate; + + public SplitPredicate(Expression equalPredicate, Expression rangePredicate, Expression residualPredicate) { + this.equalPredicate = equalPredicate; + this.rangePredicate = rangePredicate; + this.residualPredicate = residualPredicate; } public Expression getEqualPredicate() { - return equalPredicates; + return equalPredicate; } public Expression getRangePredicate() { - return rangePredicates; + return rangePredicate; } public Expression getResidualPredicate() { - return residualPredicates; + return residualPredicate; } public static SplitPredicate empty() { @@ -101,25 +101,25 @@ public static SplitPredicate of(Expression equalPredicates, * isEmpty * */ public boolean isEmpty() { - return equalPredicates == null - && rangePredicates == null - && residualPredicates == null; + return equalPredicate == null + && rangePredicate == null + && residualPredicate == null; } public List toList() { - return ImmutableList.of(equalPredicates, rangePredicates, residualPredicates); + return ImmutableList.of(equalPredicate, rangePredicate, residualPredicate); } /** * Check the predicates in SplitPredicate is whether all true or not */ public boolean isAlwaysTrue() { - return equalPredicates instanceof BooleanLiteral - && rangePredicates instanceof BooleanLiteral - && residualPredicates instanceof BooleanLiteral - && ((BooleanLiteral) equalPredicates).getValue() - && ((BooleanLiteral) rangePredicates).getValue() - && ((BooleanLiteral) residualPredicates).getValue(); + return equalPredicate instanceof BooleanLiteral + && rangePredicate instanceof BooleanLiteral + && residualPredicate instanceof BooleanLiteral + && ((BooleanLiteral) equalPredicate).getValue() + && ((BooleanLiteral) rangePredicate).getValue() + && ((BooleanLiteral) residualPredicate).getValue(); } } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/PredicatesSplitter.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/PredicatesSplitter.java index 2975b0c61aaf47..dadefc4a38ff86 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/PredicatesSplitter.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/PredicatesSplitter.java @@ -21,6 +21,7 @@ import org.apache.doris.nereids.trees.expressions.Cast; import org.apache.doris.nereids.trees.expressions.ComparisonPredicate; import org.apache.doris.nereids.trees.expressions.CompoundPredicate; +import org.apache.doris.nereids.trees.expressions.EqualPredicate; import org.apache.doris.nereids.trees.expressions.EqualTo; import org.apache.doris.nereids.trees.expressions.Expression; import org.apache.doris.nereids.trees.expressions.NullSafeEqual; @@ -40,10 +41,10 @@ */ public class PredicatesSplitter { - private List equalPredicates = new ArrayList<>(); - private List rangePredicates = new ArrayList<>(); - private List residualPredicates = new ArrayList<>(); - private List conjunctExpressions; + private final List equalPredicates = new ArrayList<>(); + private final List rangePredicates = new ArrayList<>(); + private final List residualPredicates = new ArrayList<>(); + private final List conjunctExpressions; private final PredicateExtract instance = new PredicateExtract(); @@ -63,7 +64,7 @@ public Void visitComparisonPredicate(ComparisonPredicate comparisonPredicate, Ex Expression rightArg = comparisonPredicate.getArgument(1); boolean leftArgOnlyContainsColumnRef = containOnlyColumnRef(leftArg, true); boolean rightArgOnlyContainsColumnRef = containOnlyColumnRef(rightArg, true); - if (comparisonPredicate instanceof EqualTo || comparisonPredicate instanceof NullSafeEqual) { + if (comparisonPredicate instanceof EqualPredicate) { if (leftArgOnlyContainsColumnRef && rightArgOnlyContainsColumnRef) { equalPredicates.add(comparisonPredicate); return null; @@ -85,7 +86,7 @@ public Void visitCompoundPredicate(CompoundPredicate compoundPredicate, Expressi residualPredicates.add(compoundPredicate); return null; } - return super.visitCompoundPredicate(compoundPredicate, context); + return super.visit(compoundPredicate, context); } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/mapping/RelationMapping.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/mapping/RelationMapping.java index 7fb857d3d4c77c..cc65258142d59c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/mapping/RelationMapping.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/mapping/RelationMapping.java @@ -116,11 +116,12 @@ public static List generate(List sources, List } private static String getTableQualifier(TableIf tableIf) { - String tableName = tableIf.getName(); - DatabaseIf database = tableIf.getDatabase(); - if (database == null) { - return null; - } - return database.getFullName() + ":" + tableName; + return String.valueOf(tableIf.getId()); + // String tableName = tableIf.getName(); + // DatabaseIf database = tableIf.getDatabase(); + // if (database == null) { + // return null; + // } + // return database.getFullName() + ":" + tableName; } }