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

项目:presto    文件:StatementAnalyzer.java   
@Override
protected RelationType visitShowColumns(ShowColumns showColumns, AnalysisContext context)
{
    QualifiedObjectName tableName = createQualifiedObjectName(session, showColumns, showColumns.getTable());

    if (!metadata.getView(session, tableName).isPresent() &&
            !metadata.getTableHandle(session, tableName).isPresent()) {
        throw new SemanticException(MISSING_TABLE, showColumns, "Table '%s' does not exist", tableName);
    }

    Query query = simpleQuery(
            selectList(
                    aliasedName("column_name", "Column"),
                    aliasedName("data_type", "Type"),
                    aliasedNullToEmpty("comment", "Comment")),
            from(tableName.getCatalogName(), TABLE_COLUMNS),
            logicalAnd(
                    equal(nameReference("table_schema"), new StringLiteral(tableName.getSchemaName())),
                    equal(nameReference("table_name"), new StringLiteral(tableName.getObjectName()))),
            ordering(ascending("ordinal_position")));

    return process(query, context);
}
项目:presto-query-formatter    文件:StatementFormatter.java   
@Override
protected Void visitShowColumns(ShowColumns node, Integer context)
{
    builder.append("SHOW COLUMNS FROM ")
            .append(node.getTable());

    return null;
}
项目:presto    文件:SqlFormatter.java   
@Override
protected Void visitShowColumns(ShowColumns node, Integer context)
{
    builder.append("SHOW COLUMNS FROM ")
            .append(node.getTable());

    return null;
}
项目:EchoQuery    文件:SqlFormatter.java   
@Override
protected Void visitShowColumns(ShowColumns node, Integer context)
{
    builder.append("SHOW COLUMNS FROM ")
            .append(node.getTable());

    return null;
}
项目:presto    文件:AstBuilder.java   
@Override
public Node visitShowColumns(SqlBaseParser.ShowColumnsContext context)
{
    return new ShowColumns(getLocation(context), getQualifiedName(context.qualifiedName()));
}