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

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

    return null;
}
项目:presto    文件:StatementAnalyzer.java   
@Override
protected RelationType visitShowSession(ShowSession node, AnalysisContext context)
{
    ImmutableList.Builder<Expression> rows = ImmutableList.builder();
    List<SessionPropertyValue> sessionProperties = metadata.getSessionPropertyManager().getAllSessionProperties(session);
    for (SessionPropertyValue sessionProperty : sessionProperties) {
        if (sessionProperty.isHidden()) {
            continue;
        }

        String value = sessionProperty.getValue();
        String defaultValue = sessionProperty.getDefaultValue();
        rows.add(row(
                new StringLiteral(sessionProperty.getFullyQualifiedName()),
                new StringLiteral(nullToEmpty(value)),
                new StringLiteral(nullToEmpty(defaultValue)),
                new StringLiteral(sessionProperty.getType()),
                new StringLiteral(sessionProperty.getDescription()),
                TRUE_LITERAL));
    }

    // add bogus row so we can support empty sessions
    StringLiteral empty = new StringLiteral("");
    rows.add(row(empty, empty, empty, empty, empty, FALSE_LITERAL));

    Query query = simpleQuery(
            selectList(
                    aliasedName("name", "Name"),
                    aliasedName("value", "Value"),
                    aliasedName("default", "Default"),
                    aliasedName("type", "Type"),
                    aliasedName("description", "Description")),
            aliased(
                    new Values(rows.build()),
                    "session",
                    ImmutableList.of("name", "value", "default", "type", "description", "include")),
            nameReference("include"));

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

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

    return null;
}
项目:presto    文件:AstBuilder.java   
@Override
public Node visitShowSession(SqlBaseParser.ShowSessionContext context)
{
    return new ShowSession(getLocation(context));
}
项目:presto    文件:TestSqlParser.java   
@Test
public void testShowSession()
        throws Exception
{
    assertStatement("SHOW SESSION", new ShowSession());
}