@Override protected Void visitShowCatalogs(ShowCatalogs node, Integer context) { builder.append("SHOW CATALOGS"); node.getLikePattern().ifPresent((value) -> builder.append(" LIKE ") .append(formatStringLiteral(value))); return null; }
@Override protected RelationType visitShowCatalogs(ShowCatalogs node, AnalysisContext context) { List<Expression> rows = metadata.getCatalogNames().keySet().stream() .map(name -> row(new StringLiteral(name))) .collect(toList()); Query query = simpleQuery( selectList(new AllColumns()), aliased(new Values(rows), "catalogs", ImmutableList.of("Catalog"))); return process(query, context); }
@Override protected Void visitShowCatalogs(ShowCatalogs node, Integer context) { builder.append("SHOW CATALOGS"); return null; }
@Override public Node visitShowCatalogs(SqlBaseParser.ShowCatalogsContext context) { return new ShowCatalogs(getLocation(context)); }
@Test public void testShowCatalogs() throws Exception { assertStatement("SHOW CATALOGS", new ShowCatalogs()); }