Skip to content

Commit f8b354b

Browse files
Christoph Büscherkcm
authored andcommitted
[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.
1 parent bb1ca00 commit f8b354b

File tree

1 file changed

+2
-25
lines changed

1 file changed

+2
-25
lines changed

x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/parser/LogicalPlanBuilder.java

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import org.elasticsearch.xpack.sql.parser.SqlBaseParser.GroupByContext;
1919
import org.elasticsearch.xpack.sql.parser.SqlBaseParser.JoinCriteriaContext;
2020
import org.elasticsearch.xpack.sql.parser.SqlBaseParser.JoinRelationContext;
21-
import org.elasticsearch.xpack.sql.parser.SqlBaseParser.JoinTypeContext;
2221
import org.elasticsearch.xpack.sql.parser.SqlBaseParser.LimitClauseContext;
2322
import org.elasticsearch.xpack.sql.parser.SqlBaseParser.NamedQueryContext;
2423
import org.elasticsearch.xpack.sql.parser.SqlBaseParser.QueryContext;
@@ -33,7 +32,6 @@
3332
import org.elasticsearch.xpack.sql.plan.logical.Distinct;
3433
import org.elasticsearch.xpack.sql.plan.logical.Filter;
3534
import org.elasticsearch.xpack.sql.plan.logical.Join;
36-
import org.elasticsearch.xpack.sql.plan.logical.Join.JoinType;
3735
import org.elasticsearch.xpack.sql.plan.logical.Limit;
3836
import org.elasticsearch.xpack.sql.plan.logical.LocalRelation;
3937
import org.elasticsearch.xpack.sql.plan.logical.LogicalPlan;
@@ -168,41 +166,20 @@ public LogicalPlan visitRelation(RelationContext ctx) {
168166

169167
LogicalPlan result = plan(ctx.relationPrimary());
170168
for (JoinRelationContext j : ctx.joinRelation()) {
171-
result = doJoin(result, j);
169+
result = doJoin(j);
172170
}
173171

174172
return result;
175173
}
176174

177-
private Join doJoin(LogicalPlan left, JoinRelationContext ctx) {
178-
JoinTypeContext joinType = ctx.joinType();
175+
private Join doJoin(JoinRelationContext ctx) {
179176

180-
@SuppressWarnings("unused")
181-
Join.JoinType type = JoinType.INNER;
182-
if (joinType != null) {
183-
if (joinType.FULL() != null) {
184-
type = JoinType.FULL;
185-
}
186-
if (joinType.LEFT() != null) {
187-
type = JoinType.LEFT;
188-
}
189-
if (joinType.RIGHT() != null) {
190-
type = JoinType.RIGHT;
191-
}
192-
}
193-
194-
@SuppressWarnings("unused")
195-
Expression condition = null;
196177
JoinCriteriaContext criteria = ctx.joinCriteria();
197178
if (criteria != null) {
198179
if (criteria.USING() != null) {
199180
throw new UnsupportedOperationException();
200181
}
201-
if (criteria.booleanExpression() != null) {
202-
condition = expression(criteria.booleanExpression());
203-
}
204182
}
205-
206183
// We would return this if we actually supported JOINs, but we don't yet.
207184
// new Join(source(ctx), left, plan(ctx.right), type, condition);
208185
throw new ParsingException(source(ctx), "Queries with JOIN are not yet supported");

0 commit comments

Comments
 (0)