@Override public Void visitIndexSource(IndexSourceNode node, Void context) { TableHandle tableHandle = node.getTableHandle(); Set<Column> columns = new HashSet<>(); for (ColumnHandle columnHandle : node.getAssignments().values()) { columns.add(createColumn(metadata.getColumnMetadata(session, tableHandle, columnHandle))); } inputs.add(createInput(metadata.getTableMetadata(session, tableHandle), node.getLayout(), columns)); return null; }
@Override public Void visitTableScan(TableScanNode node, Void context) { TableHandle tableHandle = node.getTable(); Set<Column> columns = new HashSet<>(); for (ColumnHandle columnHandle : node.getAssignments().values()) { columns.add(createColumn(metadata.getColumnMetadata(session, tableHandle, columnHandle))); } inputs.add(createInput(metadata.getTableMetadata(session, tableHandle), node.getLayout(), columns)); return null; }
@Override public Void visitTableScan(TableScanNode node, Void context) { TableHandle tableHandle = node.getTable(); Set<Column> columns = new HashSet<>(); for (ColumnHandle columnHandle : node.getAssignments().values()) { columns.add(createColumn(metadata.getColumnMetadata(session, tableHandle, columnHandle))); } inputs.add(createInput(metadata.getTableMetadata(session, tableHandle), node.getLayout(), columns)); return null; }
@Override public Void visitIndexSource(IndexSourceNode node, Void context) { TableHandle tableHandle = node.getTableHandle(); Set<Column> columns = new HashSet<>(); for (ColumnHandle columnHandle : node.getAssignments().values()) { columns.add(createColumn(metadata.getColumnMetadata(session, tableHandle, columnHandle))); } inputs.add(createInput(metadata.getTableMetadata(session, tableHandle), node.getLayout(), columns)); return null; }
protected final List<Type> getColumnTypes(String tableName, String... columnNames) { checkState(session.getCatalog().isPresent(), "catalog not set"); checkState(session.getSchema().isPresent(), "schema not set"); // look up the table Metadata metadata = localQueryRunner.getMetadata(); QualifiedObjectName qualifiedTableName = new QualifiedObjectName(session.getCatalog().get(), session.getSchema().get(), tableName); TableHandle tableHandle = metadata.getTableHandle(session, qualifiedTableName) .orElseThrow(() -> new IllegalArgumentException(format("Table %s does not exist", qualifiedTableName))); Map<String, ColumnHandle> allColumnHandles = metadata.getColumnHandles(session, tableHandle); return Arrays.stream(columnNames) .map(allColumnHandles::get) .map(columnHandle -> metadata.getColumnMetadata(session, tableHandle, columnHandle).getType()) .collect(toImmutableList()); }
private Set<ColumnConstraint> parseConstraints(TableHandle tableHandle, TupleDomain<ColumnHandle> constraint) { checkArgument(!constraint.isNone()); ImmutableSet.Builder<ColumnConstraint> columnConstraints = ImmutableSet.builder(); for (Map.Entry<ColumnHandle, Domain> entry : constraint.getDomains().get().entrySet()) { ColumnMetadata columnMetadata = metadata.getColumnMetadata(session, tableHandle, entry.getKey()); columnConstraints.add(new ColumnConstraint( columnMetadata.getName(), columnMetadata.getType().getTypeSignature(), parseDomain(entry.getValue().simplify()))); } return columnConstraints.build(); }
private Set<ColumnConstraint> parseConstraints(TableHandle tableHandle, TupleDomain<ColumnHandle> constraint) { checkArgument(!constraint.isNone()); ImmutableSet.Builder<ColumnConstraint> columnConstraints = ImmutableSet.builder(); for (Map.Entry<ColumnHandle, Domain> entry : constraint.getDomains().get().entrySet()) { ColumnMetadata columnMetadata = metadata.getColumnMetadata(session, tableHandle, entry.getKey()); columnConstraints.add(new ColumnConstraint( columnMetadata.getName(), columnMetadata.getType().getTypeSignature(), parseDomain(entry.getValue().simplify()))); } return columnConstraints.build(); }
protected final List<Type> getColumnTypes(String tableName, String... columnNames) { checkState(session.getCatalog().isPresent(), "catalog not set"); checkState(session.getSchema().isPresent(), "schema not set"); // look up the table Metadata metadata = localQueryRunner.getMetadata(); QualifiedObjectName qualifiedTableName = new QualifiedObjectName(session.getCatalog().get(), session.getSchema().get(), tableName); TableHandle tableHandle = metadata.getTableHandle(session, qualifiedTableName) .orElseThrow(() -> new IllegalArgumentException(format("Table %s does not exist", qualifiedTableName))); Map<String, ColumnHandle> allColumnHandles = metadata.getColumnHandles(session, tableHandle); return Arrays.stream(columnNames) .map(allColumnHandles::get) .map(columnHandle -> metadata.getColumnMetadata(session, tableHandle, columnHandle).getType()) .collect(toImmutableList()); }
Map<String, ColumnHandle> columnHandles = metadata.getColumnHandles(session, tableHandle); List<ColumnHandle> visibleColumnHandles = columnHandles.values().stream() .filter(handle -> !metadata.getColumnMetadata(session, tableHandle, handle).isHidden()) .collect(toImmutableList()); checkSpatialPartitioningTable(visibleColumnHandles.size() == 1, "Expected single column for table %s, but found %s columns", name, columnHandles.size());
for (Symbol symbol : inputs) { ColumnHandle column = tableScan.getAssignments().get(symbol); ColumnMetadata columnMetadata = metadata.getColumnMetadata(session, tableScan.getTable(), column);
Map<String, ColumnHandle> columnHandles = metadata.getColumnHandles(session, tableHandle); List<ColumnHandle> visibleColumnHandles = columnHandles.values().stream() .filter(handle -> !metadata.getColumnMetadata(session, tableHandle, handle).isHidden()) .collect(toImmutableList()); checkSpatialPartitioningTable(visibleColumnHandles.size() == 1, "Expected single column for table %s, but found %s columns", name, columnHandles.size());
for (Symbol symbol : inputs) { ColumnHandle column = tableScan.getAssignments().get(symbol); ColumnMetadata columnMetadata = metadata.getColumnMetadata(session, tableScan.getTable(), column);
if (metadata.getColumnMetadata(session, tableHandle, columnHandle).isHidden()) { throw new SemanticException(NOT_SUPPORTED, statement, "Cannot drop hidden column");
if (metadata.getColumnMetadata(session, tableHandle, columnHandle).isHidden()) { throw new SemanticException(NOT_SUPPORTED, statement, "Cannot drop hidden column");
if (metadata.getColumnMetadata(session, tableHandle, columnHandle).isHidden()) { throw new SemanticException(NOT_SUPPORTED, statement, "Cannot rename hidden column");
if (metadata.getColumnMetadata(session, tableHandle, columnHandle).isHidden()) { throw new SemanticException(NOT_SUPPORTED, statement, "Cannot rename hidden column");
TableHandle handle = analysis.getTableHandle(node.getTable()); ColumnHandle rowIdHandle = metadata.getUpdateRowIdColumnHandle(session, handle); Type rowIdType = metadata.getColumnMetadata(session, handle, rowIdHandle).getType();
TableHandle handle = analysis.getTableHandle(node.getTable()); ColumnHandle rowIdHandle = metadata.getUpdateRowIdColumnHandle(session, handle); Type rowIdType = metadata.getColumnMetadata(session, handle, rowIdHandle).getType();