Java 类com.facebook.presto.sql.tree.ExplainOption 实例源码

项目:presto-query-formatter    文件:StatementFormatter.java   
@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;
}
项目:presto    文件:SqlFormatter.java   
@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;
}
项目:EchoQuery    文件:SqlFormatter.java   
@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;
}
项目:presto    文件:AstBuilder.java   
@Override
public Node visitExplain(SqlBaseParser.ExplainContext context)
{
    return new Explain(getLocation(context), (Statement) visit(context.statement()), visit(context.explainOption(), ExplainOption.class));
}