本文整理汇总了Java中com.facebook.presto.sql.tree.Union类的典型用法代码示例。如果您正苦于以下问题:Java Union类的具体用法?Java Union怎么用?Java Union使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Union类属于com.facebook.presto.sql.tree包,在下文中一共展示了Union类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitUnion
import com.facebook.presto.sql.tree.Union; //导入依赖的package包/类
@Override
protected Void visitUnion(Union node, Integer indent)
{
Iterator<Relation> relations = node.getRelations().iterator();
while (relations.hasNext()) {
processRelation(relations.next(), indent);
if (relations.hasNext()) {
builder.append("UNION ");
if (!node.isDistinct()) {
builder.append("ALL ");
}
}
}
return null;
}
示例2: visitSetOperation
import com.facebook.presto.sql.tree.Union; //导入依赖的package包/类
@Override
public Node visitSetOperation(SqlBaseParser.SetOperationContext context)
{
QueryBody left = (QueryBody) visit(context.left);
QueryBody right = (QueryBody) visit(context.right);
boolean distinct = context.setQuantifier() == null || context.setQuantifier().DISTINCT() != null;
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());
}
示例3: testUnion
import com.facebook.presto.sql.tree.Union; //导入依赖的package包/类
@Test
public void testUnion()
{
assertStatement("SELECT 123 UNION DISTINCT SELECT 123 UNION ALL SELECT 123",
new Query(
Optional.empty(),
new Union(ImmutableList.of(
new Union(ImmutableList.of(createSelect123(), createSelect123()), true),
createSelect123()
), false),
ImmutableList.<SortItem>of(),
Optional.empty(),
Optional.empty()));
}