From 5f19146bace768255363c748fdcaa2c94766f299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20B=C3=BCscher?= Date: Thu, 27 Sep 2018 16:27:49 +0200 Subject: [PATCH] [SQL] Clean up LogicalPlanBuilder#doJoin (#34048) Currently the local `type` and `condition` variables are unused and can be removed. This code can be added later again if joins are supported. --- .../xpack/sql/parser/LogicalPlanBuilder.java | 27 ++----------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/parser/LogicalPlanBuilder.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/parser/LogicalPlanBuilder.java index 7d41e6e677d..23d2c20d305 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/parser/LogicalPlanBuilder.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/parser/LogicalPlanBuilder.java @@ -18,7 +18,6 @@ import org.elasticsearch.xpack.sql.parser.SqlBaseParser.FromClauseContext; import org.elasticsearch.xpack.sql.parser.SqlBaseParser.GroupByContext; import org.elasticsearch.xpack.sql.parser.SqlBaseParser.JoinCriteriaContext; import org.elasticsearch.xpack.sql.parser.SqlBaseParser.JoinRelationContext; -import org.elasticsearch.xpack.sql.parser.SqlBaseParser.JoinTypeContext; import org.elasticsearch.xpack.sql.parser.SqlBaseParser.LimitClauseContext; import org.elasticsearch.xpack.sql.parser.SqlBaseParser.NamedQueryContext; import org.elasticsearch.xpack.sql.parser.SqlBaseParser.QueryContext; @@ -33,7 +32,6 @@ import org.elasticsearch.xpack.sql.plan.logical.Aggregate; import org.elasticsearch.xpack.sql.plan.logical.Distinct; import org.elasticsearch.xpack.sql.plan.logical.Filter; import org.elasticsearch.xpack.sql.plan.logical.Join; -import org.elasticsearch.xpack.sql.plan.logical.Join.JoinType; import org.elasticsearch.xpack.sql.plan.logical.Limit; import org.elasticsearch.xpack.sql.plan.logical.LocalRelation; import org.elasticsearch.xpack.sql.plan.logical.LogicalPlan; @@ -168,41 +166,20 @@ abstract class LogicalPlanBuilder extends ExpressionBuilder { LogicalPlan result = plan(ctx.relationPrimary()); for (JoinRelationContext j : ctx.joinRelation()) { - result = doJoin(result, j); + result = doJoin(j); } return result; } - private Join doJoin(LogicalPlan left, JoinRelationContext ctx) { - JoinTypeContext joinType = ctx.joinType(); + private Join doJoin(JoinRelationContext ctx) { - @SuppressWarnings("unused") - Join.JoinType type = JoinType.INNER; - if (joinType != null) { - if (joinType.FULL() != null) { - type = JoinType.FULL; - } - if (joinType.LEFT() != null) { - type = JoinType.LEFT; - } - if (joinType.RIGHT() != null) { - type = JoinType.RIGHT; - } - } - - @SuppressWarnings("unused") - Expression condition = null; JoinCriteriaContext criteria = ctx.joinCriteria(); if (criteria != null) { if (criteria.USING() != null) { throw new UnsupportedOperationException(); } - if (criteria.booleanExpression() != null) { - condition = expression(criteria.booleanExpression()); - } } - // We would return this if we actually supported JOINs, but we don't yet. // new Join(source(ctx), left, plan(ctx.right), type, condition); throw new ParsingException(source(ctx), "Queries with JOIN are not yet supported");