use of com.facebook.presto.sql.tree.Except in project presto by prestodb.
the class AstBuilder method visitSetOperation.
@Override
public Node visitSetOperation(SqlBaseParser.SetOperationContext context) {
QueryBody left = (QueryBody) visit(context.left);
QueryBody right = (QueryBody) visit(context.right);
Optional<Boolean> distinct = Optional.empty();
if (context.setQuantifier() != null) {
if (context.setQuantifier().DISTINCT() != null) {
distinct = Optional.of(true);
} else if (context.setQuantifier().ALL() != null) {
distinct = Optional.of(false);
}
}
switch(context.operator.getType()) {
case SqlBaseLexer.UNION:
return new Union(getLocation(context.UNION()), ImmutableList.of(left, right), distinct);
case SqlBaseLexer.INTERSECT:
return new Intersect(getLocation(context.INTERSECT()), ImmutableList.of(left, right), distinct);
case SqlBaseLexer.EXCEPT:
return new Except(getLocation(context.EXCEPT()), left, right, distinct);
}
throw new IllegalArgumentException("Unsupported set operation: " + context.operator.getText());
}
use of com.facebook.presto.sql.tree.Except in project presto by prestodb.
the class PredicateStitcher method visitExcept.
@Override
protected Node visitExcept(Except node, PredicateStitcherContext context) {
Relation rewrittenLeft = (Relation) process(node.getLeft(), context);
Relation rewrittenRight = (Relation) process(node.getRight(), context);
return new Except(rewrittenLeft, rewrittenRight, node.isDistinct());
}
Aggregations