Java 类com.facebook.presto.sql.tree.ShowSchemas 实例源码
项目:presto-query-formatter
文件:StatementFormatter.java
@Override
protected Void visitShowSchemas(ShowSchemas node, Integer context)
{
builder.append("SHOW SCHEMAS");
if (node.getCatalog().isPresent()) {
builder.append(" FROM ")
.append(node.getCatalog().get());
}
node.getLikePattern().ifPresent((value) ->
builder.append(" LIKE ")
.append(formatStringLiteral(value)));
return null;
}
项目:presto
文件:StatementAnalyzer.java
@Override
protected RelationType visitShowSchemas(ShowSchemas node, AnalysisContext context)
{
if (!node.getCatalog().isPresent() && !session.getCatalog().isPresent()) {
throw new SemanticException(CATALOG_NOT_SPECIFIED, node, "Catalog must be specified when session catalog is not set");
}
Query query = simpleQuery(
selectList(aliasedName("schema_name", "Schema")),
from(node.getCatalog().orElseGet(() -> session.getCatalog().get()), TABLE_SCHEMATA),
ordering(ascending("schema_name")));
return process(query, context);
}
项目:presto
文件:SqlFormatter.java
@Override
protected Void visitShowSchemas(ShowSchemas node, Integer context)
{
builder.append("SHOW SCHEMAS");
if (node.getCatalog().isPresent()) {
builder.append(" FROM ")
.append(node.getCatalog().get());
}
return null;
}
项目:presto
文件:TestSqlParser.java
@Test
public void testShowSchemas()
throws Exception
{
assertStatement("SHOW SCHEMAS", new ShowSchemas(Optional.<String>empty()));
assertStatement("SHOW SCHEMAS FROM foo", new ShowSchemas(Optional.of("foo")));
assertStatement("SHOW SCHEMAS IN foo", new ShowSchemas(Optional.of("foo")));
}
项目:EchoQuery
文件:SqlFormatter.java
@Override
protected Void visitShowSchemas(ShowSchemas node, Integer context)
{
builder.append("SHOW SCHEMAS");
if (node.getCatalog().isPresent()) {
builder.append(" FROM ")
.append(node.getCatalog().get());
}
return null;
}
项目:presto
文件:AstBuilder.java
@Override
public Node visitShowSchemas(SqlBaseParser.ShowSchemasContext context)
{
return new ShowSchemas(getLocation(context), getTextIfPresent(context.identifier()));
}