use of io.crate.sql.tree.QueryBody in project crate by crate.
the class AstBuilder method visitSetOperation.
@Override
public Node visitSetOperation(SqlBaseParser.SetOperationContext context) {
switch(context.operator.getType()) {
case SqlBaseLexer.UNION:
QueryBody left = (QueryBody) visit(context.left);
QueryBody right = (QueryBody) visit(context.right);
boolean isDistinct = context.setQuant() == null || context.setQuant().ALL() == null;
return new Union(left, right, isDistinct);
case SqlBaseLexer.INTERSECT:
QuerySpecification first = (QuerySpecification) visit(context.first);
QuerySpecification second = (QuerySpecification) visit(context.second);
return new Intersect(first, second);
case SqlBaseLexer.EXCEPT:
first = (QuerySpecification) visit(context.first);
second = (QuerySpecification) visit(context.second);
return new Except(first, second);
default:
throw new IllegalArgumentException("Unsupported set operation: " + context.operator.getText());
}
}
Aggregations