Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
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;
Expand All @@ -33,7 +32,6 @@
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;
Expand Down Expand Up @@ -168,41 +166,20 @@ public LogicalPlan visitRelation(RelationContext ctx) {

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");
Expand Down