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

项目:presto-query-formatter    文件:StatementFormatter.java   
@Override
protected Void visitShowFunctions(ShowFunctions node, Integer context)
{
    builder.append("SHOW FUNCTIONS");

    return null;
}
项目:presto    文件:StatementAnalyzer.java   
@Override
protected RelationType visitShowFunctions(ShowFunctions node, AnalysisContext context)
{
    ImmutableList.Builder<Expression> rows = ImmutableList.builder();
    for (SqlFunction function : metadata.listFunctions()) {
        if (function.getSignature().getKind() == APPROXIMATE_AGGREGATE) {
            continue;
        }
        rows.add(row(
                new StringLiteral(function.getSignature().getName()),
                new StringLiteral(function.getSignature().getReturnType().toString()),
                new StringLiteral(Joiner.on(", ").join(function.getSignature().getArgumentTypes())),
                new StringLiteral(getFunctionType(function)),
                function.isDeterministic() ? TRUE_LITERAL : FALSE_LITERAL,
                new StringLiteral(nullToEmpty(function.getDescription()))));
    }

    Map<String, String> columns = ImmutableMap.<String, String>builder()
            .put("function_name", "Function")
            .put("return_type", "Return Type")
            .put("argument_types", "Argument Types")
            .put("function_type", "Function Type")
            .put("deterministic", "Deterministic")
            .put("description", "Description")
            .build();

    Query query = simpleQuery(
            selectAll(columns.entrySet().stream()
                    .map(entry -> aliasedName(entry.getKey(), entry.getValue()))
                    .collect(toImmutableList())),
            aliased(new Values(rows.build()), "functions", ImmutableList.copyOf(columns.keySet())),
            ordering(
                    ascending("function_name"),
                    ascending("return_type"),
                    ascending("argument_types"),
                    ascending("function_type")));

    return process(query, context);
}
项目:presto    文件:SqlFormatter.java   
@Override
protected Void visitShowFunctions(ShowFunctions node, Integer context)
{
    builder.append("SHOW FUNCTIONS");

    return null;
}
项目:EchoQuery    文件:SqlFormatter.java   
@Override
protected Void visitShowFunctions(ShowFunctions node, Integer context)
{
    builder.append("SHOW FUNCTIONS");

    return null;
}
项目:presto    文件:AstBuilder.java   
@Override
public Node visitShowFunctions(SqlBaseParser.ShowFunctionsContext context)
{
    return new ShowFunctions(getLocation(context));
}