当前位置: 首页>>代码示例>>Java>>正文


Java ShowPartitions类代码示例

本文整理汇总了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;
}
 
开发者ID:prestodb-rocks,项目名称:presto-query-formatter,代码行数:24,代码来源:StatementFormatter.java

示例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;
}
 
开发者ID:y-lan,项目名称:presto,代码行数:24,代码来源:SqlFormatter.java

示例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));
}
 
开发者ID:y-lan,项目名称:presto,代码行数:11,代码来源:AstBuilder.java

示例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")));
}
 
开发者ID:y-lan,项目名称:presto,代码行数:34,代码来源:TestSqlParser.java


注:本文中的com.facebook.presto.sql.tree.ShowPartitions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。