本文整理汇总了Java中com.facebook.presto.sql.tree.ShowPartitions类的典型用法代码示例。如果您正苦于以下问题:Java ShowPartitions类的具体用法?Java ShowPartitions怎么用?Java ShowPartitions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ShowPartitions类属于com.facebook.presto.sql.tree包,在下文中一共展示了ShowPartitions类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitShowPartitions
import com.facebook.presto.sql.tree.ShowPartitions; //导入依赖的package包/类
@Override
protected Void visitShowPartitions(ShowPartitions node, Integer indent)
{
builder.append("SHOW PARTITIONS FROM ")
.append(node.getTable());
if (node.getWhere().isPresent()) {
builder.append(" WHERE ")
.append(formatExpression(node.getWhere().get(), parameters, indent));
}
if (!node.getOrderBy().isEmpty()) {
builder.append(" ORDER BY ")
.append(formatSortItems(node.getOrderBy(), parameters, indent));
}
if (node.getLimit().isPresent()) {
builder.append(" LIMIT ")
.append(node.getLimit().get());
}
return null;
}
示例2: visitShowPartitions
import com.facebook.presto.sql.tree.ShowPartitions; //导入依赖的package包/类
@Override
protected Void visitShowPartitions(ShowPartitions node, Integer context)
{
builder.append("SHOW PARTITIONS FROM ")
.append(node.getTable());
if (node.getWhere().isPresent()) {
builder.append(" WHERE ")
.append(formatExpression(node.getWhere().get()));
}
if (!node.getOrderBy().isEmpty()) {
builder.append(" ORDER BY ")
.append(formatSortItems(node.getOrderBy()));
}
if (node.getLimit().isPresent()) {
builder.append(" LIMIT ")
.append(node.getLimit().get());
}
return null;
}
示例3: visitShowPartitions
import com.facebook.presto.sql.tree.ShowPartitions; //导入依赖的package包/类
@Override
public Node visitShowPartitions(SqlBaseParser.ShowPartitionsContext context)
{
return new ShowPartitions(
getLocation(context),
getQualifiedName(context.qualifiedName()),
visitIfPresent(context.booleanExpression(), Expression.class),
visit(context.sortItem(), SortItem.class),
getTextIfPresent(context.limit));
}
示例4: testShowPartitions
import com.facebook.presto.sql.tree.ShowPartitions; //导入依赖的package包/类
@Test
public void testShowPartitions()
{
assertStatement("SHOW PARTITIONS FROM t", new ShowPartitions(QualifiedName.of("t"), Optional.empty(), ImmutableList.of(), Optional.empty()));
assertStatement("SHOW PARTITIONS FROM t WHERE x = 1",
new ShowPartitions(
QualifiedName.of("t"),
Optional.of(new ComparisonExpression(ComparisonExpression.Type.EQUAL, new QualifiedNameReference(QualifiedName.of("x")), new LongLiteral("1"))),
ImmutableList.of(),
Optional.empty()));
assertStatement("SHOW PARTITIONS FROM t WHERE x = 1 ORDER BY y",
new ShowPartitions(
QualifiedName.of("t"),
Optional.of(new ComparisonExpression(ComparisonExpression.Type.EQUAL, new QualifiedNameReference(QualifiedName.of("x")), new LongLiteral("1"))),
ImmutableList.of(new SortItem(new QualifiedNameReference(QualifiedName.of("y")), SortItem.Ordering.ASCENDING, SortItem.NullOrdering.UNDEFINED)),
Optional.empty()));
assertStatement("SHOW PARTITIONS FROM t WHERE x = 1 ORDER BY y LIMIT 10",
new ShowPartitions(
QualifiedName.of("t"),
Optional.of(new ComparisonExpression(ComparisonExpression.Type.EQUAL, new QualifiedNameReference(QualifiedName.of("x")), new LongLiteral("1"))),
ImmutableList.of(new SortItem(new QualifiedNameReference(QualifiedName.of("y")), SortItem.Ordering.ASCENDING, SortItem.NullOrdering.UNDEFINED)),
Optional.of("10")));
assertStatement("SHOW PARTITIONS FROM t WHERE x = 1 ORDER BY y LIMIT ALL",
new ShowPartitions(
QualifiedName.of("t"),
Optional.of(new ComparisonExpression(ComparisonExpression.Type.EQUAL, new QualifiedNameReference(QualifiedName.of("x")), new LongLiteral("1"))),
ImmutableList.of(new SortItem(new QualifiedNameReference(QualifiedName.of("y")), SortItem.Ordering.ASCENDING, SortItem.NullOrdering.UNDEFINED)),
Optional.of("ALL")));
}