Przeglądaj źródła

[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.
Christoph Büscher 7 lat temu
rodzic
commit
5f19146bac

+ 2 - 25
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");