Don't canonicalize ON criteria in Join analysis
Canonicalization of the ON criteria for Join will be handled by CanonicalizeExpressions optimizer in optimization phase later.
@@ -36,7 +36,6 @@ import com.facebook.presto.sql.parser.ParsingException;
import com.facebook.presto.sql.parser.SqlParser;
import com.facebook.presto.sql.planner.DependencyExtractor;
import com.facebook.presto.sql.planner.ExpressionInterpreter;
-import com.facebook.presto.sql.planner.optimizations.CanonicalizeExpressions;
import com.facebook.presto.sql.tree.AddColumn;
import com.facebook.presto.sql.tree.AliasedRelation;
import com.facebook.presto.sql.tree.AllColumns;
@@ -971,12 +970,9 @@ class StatementAnalyzer
Analyzer.verifyNoAggregatesOrWindowFunctions(metadata.getFunctionRegistry(), expression, "JOIN clause");
- Expression canonicalized = CanonicalizeExpressions.canonicalizeExpression(expression);
- analyzeExpression(canonicalized, output);
-
Set<Expression> postJoinConjuncts = new HashSet<>();
- for (Expression conjunct : ExpressionUtils.extractConjuncts(canonicalized)) {
+ for (Expression conjunct : ExpressionUtils.extractConjuncts(expression)) {
conjunct = ExpressionUtils.normalize(conjunct);
if (conjunct instanceof ComparisonExpression
@@ -1020,7 +1016,7 @@ class StatementAnalyzer
}
Expression postJoinPredicate = ExpressionUtils.combineConjuncts(postJoinConjuncts);
analysis.recordSubqueries(node, analyzeExpression(postJoinPredicate, output));
- analysis.setJoinCriteria(node, canonicalized);
+ analysis.setJoinCriteria(node, expression);
}
else {
throw new UnsupportedOperationException("unsupported join criteria: " + criteria.getClass().getName());
