public static Values values(Row... row) { return new Values(ImmutableList.copyOf(row)); }
@Override public Node visitInlineTable(SqlBaseParser.InlineTableContext context) { return new Values(getLocation(context), visit(context.expression(), Expression.class)); }
@Override protected Node visitShowCatalogs(ShowCatalogs node, Void context) { List<Expression> rows = listCatalogs(session, metadata, accessControl).keySet().stream() .map(name -> row(new StringLiteral(name))) .collect(toList()); Optional<Expression> predicate = Optional.empty(); Optional<String> likePattern = node.getLikePattern(); if (likePattern.isPresent()) { predicate = Optional.of(new LikePredicate(identifier("Catalog"), new StringLiteral(likePattern.get()), Optional.empty())); } return simpleQuery( selectList(new AllColumns()), aliased(new Values(rows), "catalogs", ImmutableList.of("Catalog")), predicate, Optional.of(ordering(ascending("Catalog")))); }
.map(entry -> aliasedName(entry.getKey(), entry.getValue())) .collect(toImmutableList())), aliased(new Values(rows.build()), "functions", ImmutableList.copyOf(columns.keySet())), ordering( new SortItem(
query(new Values(ImmutableList.of(new LongLiteral("1")))), Optional.of(ImmutableList.of(identifier("x"))))))), new Table(QualifiedName.of("t")),
aliasedName("description", "Description")), aliased( new Values(rows.build()), "session", ImmutableList.of("name", "value", "default", "type", "description", "include")),
private Node rewriteShowStats(ShowStats node, Table table, Constraint<ColumnHandle> constraint) { TableHandle tableHandle = getTableHandle(node, table.getName()); TableStatistics tableStatistics = metadata.getTableStatistics(session, tableHandle, constraint); List<String> statsColumnNames = buildColumnsNames(); List<SelectItem> selectItems = buildSelectItems(statsColumnNames); TableMetadata tableMetadata = metadata.getTableMetadata(session, tableHandle); Map<String, ColumnHandle> columnHandles = metadata.getColumnHandles(session, tableHandle); List<Expression> resultRows = buildStatisticsRows(tableMetadata, columnHandles, tableStatistics); return simpleQuery(selectAll(selectItems), aliased(new Values(resultRows), "table_stats_for_" + table.getName(), statsColumnNames)); }
new Values(ImmutableList.of(new LongLiteral("1"))), Optional.empty(), Optional.empty()));
public static Values values(Row... row) { return new Values(ImmutableList.copyOf(row)); }
public static Values values(Row... row) { return new Values(ImmutableList.copyOf(row)); }
@Override public Node visitInlineTable(SqlBaseParser.InlineTableContext context) { return new Values(getLocation(context), visit(context.expression(), Expression.class)); }
@Override public Node visitInlineTable(SqlBaseParser.InlineTableContext context) { return new Values(getLocation(context), visit(context.expression(), Expression.class)); }
@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); }
.map(entry -> aliasedName(entry.getKey(), entry.getValue())) .collect(toImmutableList())), aliased(new Values(rows.build()), "functions", ImmutableList.copyOf(columns.keySet())), ordering( ascending("function_name"),
query(new Values(ImmutableList.of(new LongLiteral("1")))), Optional.of(ImmutableList.of(identifier("x"))))))), new Table(QualifiedName.of("t")),
aliasedName("description", "Description")), aliased( new Values(rows.build()), "session", ImmutableList.of("name", "value", "default", "type", "description", "include")),
new Values(ImmutableList.of(new LongLiteral("1"))), Optional.empty(), Optional.empty()));