Skip to content

Commit

Permalink
Remove unnecessary method
Browse files Browse the repository at this point in the history
  • Loading branch information
martint committed Sep 12, 2019
1 parent dfe70ca commit 2efe9b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import java.util.Set;
import java.util.stream.Collectors;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Predicates.equalTo;
import static com.google.common.base.Predicates.not;
import static com.google.common.collect.Iterables.filter;
Expand Down Expand Up @@ -81,20 +80,8 @@ private EqualityInference(Multimap<Expression, Expression> equalitySets, Map<Exp
/**
* Attempts to rewrite an Expression in terms of the symbols allowed by the symbol scope
* given the known equalities. Returns null if unsuccessful.
* This method checks if rewritten expression is non-deterministic.
*/
public Expression rewriteExpression(Expression expression, Predicate<Symbol> symbolScope)
{
checkArgument(isDeterministic(expression), "Only deterministic expressions may be considered for rewrite");
return rewriteExpression(expression, symbolScope, true);
}

/**
* Attempts to rewrite an Expression in terms of the symbols allowed by the symbol scope
* given the known equalities. Returns null if unsuccessful.
* This method allows rewriting non-deterministic expressions.
*/
public Expression rewriteExpressionAllowNonDeterministic(Expression expression, Predicate<Symbol> symbolScope)
{
return rewriteExpression(expression, symbolScope, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@ private PlanNode visitNonFilteringSemiJoin(SemiJoinNode node, RewriteContext<Exp
// Push inheritedPredicates down to the source if they don't involve the semi join output
EqualityInference inheritedInference = EqualityInference.newInstance(inheritedPredicate);
for (Expression conjunct : EqualityInference.nonInferrableConjuncts(inheritedPredicate)) {
Expression rewrittenConjunct = inheritedInference.rewriteExpressionAllowNonDeterministic(conjunct, in(node.getSource().getOutputSymbols()));
Expression rewrittenConjunct = inheritedInference.rewriteExpression(conjunct, in(node.getSource().getOutputSymbols()));
// Since each source row is reflected exactly once in the output, ok to push non-deterministic predicates down
if (rewrittenConjunct != null) {
sourceConjuncts.add(rewrittenConjunct);
Expand Down Expand Up @@ -1117,7 +1117,7 @@ private PlanNode visitFilteringSemiJoin(SemiJoinNode node, RewriteContext<Expres

// Push inheritedPredicates down to the source if they don't involve the semi join output
for (Expression conjunct : EqualityInference.nonInferrableConjuncts(inheritedPredicate)) {
Expression rewrittenConjunct = allInference.rewriteExpressionAllowNonDeterministic(conjunct, in(sourceSymbols));
Expression rewrittenConjunct = allInference.rewriteExpression(conjunct, in(sourceSymbols));
// Since each source row is reflected exactly once in the output, ok to push non-deterministic predicates down
if (rewrittenConjunct != null) {
sourceConjuncts.add(rewrittenConjunct);
Expand Down

0 comments on commit 2efe9b7

Please sign in to comment.