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


Java ExplainFormat类代码示例

本文整理汇总了Java中com.facebook.presto.sql.tree.ExplainFormat的典型用法代码示例。如果您正苦于以下问题:Java ExplainFormat类的具体用法?Java ExplainFormat怎么用?Java ExplainFormat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ExplainFormat类属于com.facebook.presto.sql.tree包,在下文中一共展示了ExplainFormat类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testExplain

import com.facebook.presto.sql.tree.ExplainFormat; //导入依赖的package包/类
@Test
public void testExplain()
        throws Exception
{
    assertStatement("EXPLAIN SELECT * FROM t",
            new Explain(simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))), ImmutableList.of()));
    assertStatement("EXPLAIN (TYPE LOGICAL) SELECT * FROM t",
            new Explain(
                    simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))),
                    ImmutableList.of(new ExplainType(ExplainType.Type.LOGICAL))));
    assertStatement("EXPLAIN (TYPE LOGICAL, FORMAT TEXT) SELECT * FROM t",
            new Explain(
                    simpleQuery(selectList(new AllColumns()), table(QualifiedName.of("t"))),
                    ImmutableList.of(
                            new ExplainType(ExplainType.Type.LOGICAL),
                            new ExplainFormat(ExplainFormat.Type.TEXT))));
}
 
开发者ID:y-lan,项目名称:presto,代码行数:18,代码来源:TestSqlParser.java

示例2: visitExplain

import com.facebook.presto.sql.tree.ExplainFormat; //导入依赖的package包/类
@Override
protected Void visitExplain(Explain node, Integer indent)
{
    builder.append("EXPLAIN ");
    if (node.isAnalyze()) {
        builder.append("ANALYZE ");
    }

    List<String> options = new ArrayList<>();

    for (ExplainOption option : node.getOptions()) {
        if (option instanceof ExplainType) {
            options.add("TYPE " + ((ExplainType) option).getType());
        }
        else if (option instanceof ExplainFormat) {
            options.add("FORMAT " + ((ExplainFormat) option).getType());
        }
        else {
            throw new UnsupportedOperationException("unhandled explain option: " + option);
        }
    }

    if (!options.isEmpty()) {
        builder.append("(");
        Joiner.on(", ").appendTo(builder, options);
        builder.append(")");
    }

    builder.append("\n");

    process(node.getStatement(), indent);

    return null;
}
 
开发者ID:prestodb-rocks,项目名称:presto-query-formatter,代码行数:35,代码来源:StatementFormatter.java

示例3: getQueryPlan

import com.facebook.presto.sql.tree.ExplainFormat; //导入依赖的package包/类
private String getQueryPlan(Explain node, ExplainType.Type planType, ExplainFormat.Type planFormat)
        throws IllegalArgumentException
{
    switch (planFormat) {
        case GRAPHVIZ:
            return queryExplainer.get().getGraphvizPlan(session, node.getStatement(), planType);
        case TEXT:
            return queryExplainer.get().getPlan(session, node.getStatement(), planType);
    }
    throw new IllegalArgumentException("Invalid Explain Format: " + planFormat.toString());
}
 
开发者ID:y-lan,项目名称:presto,代码行数:12,代码来源:StatementAnalyzer.java

示例4: visitExplain

import com.facebook.presto.sql.tree.ExplainFormat; //导入依赖的package包/类
@Override
protected Void visitExplain(Explain node, Integer indent)
{
    builder.append("EXPLAIN ");

    List<String> options = new ArrayList<>();

    for (ExplainOption option : node.getOptions()) {
        if (option instanceof ExplainType) {
            options.add("TYPE " + ((ExplainType) option).getType());
        }
        else if (option instanceof ExplainFormat) {
            options.add("FORMAT " + ((ExplainFormat) option).getType());
        }
        else {
            throw new UnsupportedOperationException("unhandled explain option: " + option);
        }
    }

    if (!options.isEmpty()) {
        builder.append("(");
        Joiner.on(", ").appendTo(builder, options);
        builder.append(")");
    }

    builder.append("\n");

    process(node.getStatement(), indent);

    return null;
}
 
开发者ID:y-lan,项目名称:presto,代码行数:32,代码来源:SqlFormatter.java

示例5: visitExplainFormat

import com.facebook.presto.sql.tree.ExplainFormat; //导入依赖的package包/类
@Override
public Node visitExplainFormat(SqlBaseParser.ExplainFormatContext context)
{
    switch (context.value.getType()) {
        case SqlBaseLexer.GRAPHVIZ:
            return new ExplainFormat(getLocation(context), ExplainFormat.Type.GRAPHVIZ);
        case SqlBaseLexer.TEXT:
            return new ExplainFormat(getLocation(context), ExplainFormat.Type.TEXT);
    }

    throw new IllegalArgumentException("Unsupported EXPLAIN format: " + context.value.getText());
}
 
开发者ID:y-lan,项目名称:presto,代码行数:13,代码来源:AstBuilder.java


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