Skip to content

Commit

Permalink
tmp modify some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
seawinde committed Dec 4, 2023
1 parent e8f1bca commit 03af108
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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<Expression> 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();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -40,10 +41,10 @@
*/
public class PredicatesSplitter {

private List<Expression> equalPredicates = new ArrayList<>();
private List<Expression> rangePredicates = new ArrayList<>();
private List<Expression> residualPredicates = new ArrayList<>();
private List<Expression> conjunctExpressions;
private final List<Expression> equalPredicates = new ArrayList<>();
private final List<Expression> rangePredicates = new ArrayList<>();
private final List<Expression> residualPredicates = new ArrayList<>();
private final List<Expression> conjunctExpressions;

private final PredicateExtract instance = new PredicateExtract();

Expand All @@ -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;
Expand All @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,12 @@ public static List<RelationMapping> generate(List<CatalogRelation> 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;
}
}

0 comments on commit 03af108

Please sign in to comment.