@Override public Map<String, ColumnHandle> getColumnHandles(Session session, TableHandle tableHandle) { ConnectorId connectorId = tableHandle.getConnectorId(); ConnectorMetadata metadata = getMetadata(session, connectorId); Map<String, ColumnHandle> handles = metadata.getColumnHandles(session.toConnectorSession(connectorId), tableHandle.getConnectorHandle()); ImmutableMap.Builder<String, ColumnHandle> map = ImmutableMap.builder(); for (Entry<String, ColumnHandle> mapEntry : handles.entrySet()) { map.put(mapEntry.getKey().toLowerCase(ENGLISH), mapEntry.getValue()); } return map.build(); }
@Override public TableHandle beginDelete(Session session, TableHandle tableHandle) { ConnectorId connectorId = tableHandle.getConnectorId(); ConnectorMetadata metadata = getMetadataForWrite(session, connectorId); ConnectorTableHandle newHandle = metadata.beginDelete(session.toConnectorSession(connectorId), tableHandle.getConnectorHandle()); return new TableHandle(tableHandle.getConnectorId(), newHandle); }
@Override public String toString() { return handle.toString(); } }
@BeforeClass public void setup() { metadata = getQueryRunner().getMetadata(); builder = new PlanBuilder(new PlanNodeIdAllocator(), metadata); ConnectorId connectorId = getCurrentConnectorId(); TableHandle nationTableHandle = new TableHandle( connectorId, new TpchTableHandle("nation", 1.0)); TableLayoutHandle nationTableLayoutHandle = new TableLayoutHandle(connectorId, TestingTransactionHandle.create(), new TpchTableLayoutHandle((TpchTableHandle) nationTableHandle.getConnectorHandle(), TupleDomain.all())); TpchColumnHandle nationkeyColumnHandle = new TpchColumnHandle("nationkey", BIGINT); symbol = new Symbol("nationkey"); tableScanNode = builder.tableScan(nationTableHandle, ImmutableList.of(symbol), ImmutableMap.of(symbol, nationkeyColumnHandle), Optional.of(nationTableLayoutHandle)); }
@Override public Optional<TableHandle> getTableHandleForStatisticsCollection(Session session, QualifiedObjectName table, Map<String, Object> analyzeProperties) { requireNonNull(table, "table is null"); Optional<CatalogMetadata> catalog = getOptionalCatalogMetadata(session, table.getCatalogName()); if (catalog.isPresent()) { CatalogMetadata catalogMetadata = catalog.get(); ConnectorId connectorId = catalogMetadata.getConnectorId(session, table); ConnectorMetadata metadata = catalogMetadata.getMetadataFor(connectorId); ConnectorTableHandle tableHandle = metadata.getTableHandleForStatisticsCollection(session.toConnectorSession(connectorId), table.asSchemaTableName(), analyzeProperties); if (tableHandle != null) { return Optional.of(new TableHandle(connectorId, tableHandle)); } } return Optional.empty(); }
private static Set<ConnectorId> extractConnectors(Analysis analysis) { ImmutableSet.Builder<ConnectorId> connectors = ImmutableSet.builder(); for (TableHandle tableHandle : analysis.getTables()) { connectors.add(tableHandle.getConnectorId()); } if (analysis.getInsert().isPresent()) { TableHandle target = analysis.getInsert().get().getTarget(); connectors.add(target.getConnectorId()); } return connectors.build(); }
if (!table.getConnectorHandle().toString().equals(layout.toString())) { print(indent + 2, "LAYOUT: %s", layout);
@BeforeClass public void setup() { metadata = getQueryRunner().getMetadata(); sqlParser = getQueryRunner().getSqlParser(); ConnectorId connectorId = getCurrentConnectorId(); nationTableHandle = new TableHandle( connectorId, new TpchTableHandle("nation", 1.0)); nationTableLayoutHandle = new TableLayoutHandle(connectorId, TestingTransactionHandle.create(), new TpchTableLayoutHandle((TpchTableHandle) nationTableHandle.getConnectorHandle(), TupleDomain.all())); }
@Override public Optional<TableHandle> getTableHandle(Session session, QualifiedObjectName table) { requireNonNull(table, "table is null"); Optional<CatalogMetadata> catalog = getOptionalCatalogMetadata(session, table.getCatalogName()); if (catalog.isPresent()) { CatalogMetadata catalogMetadata = catalog.get(); ConnectorId connectorId = catalogMetadata.getConnectorId(session, table); ConnectorMetadata metadata = catalogMetadata.getMetadataFor(connectorId); ConnectorTableHandle tableHandle = metadata.getTableHandle(session.toConnectorSession(connectorId), table.asSchemaTableName()); if (tableHandle != null) { return Optional.of(new TableHandle(connectorId, tableHandle)); } } return Optional.empty(); }
private static Set<ConnectorId> extractConnectors(Analysis analysis) { ImmutableSet.Builder<ConnectorId> connectors = ImmutableSet.builder(); for (TableHandle tableHandle : analysis.getTables()) { connectors.add(tableHandle.getConnectorId()); } if (analysis.getInsert().isPresent()) { TableHandle target = analysis.getInsert().get().getTarget(); connectors.add(target.getConnectorId()); } return connectors.build(); }
if (!table.getConnectorHandle().toString().equals(layout.toString())) { print(indent + 2, "LAYOUT: %s", layout);
@Override public Map<String, ColumnHandle> getColumnHandles(Session session, TableHandle tableHandle) { ConnectorId connectorId = tableHandle.getConnectorId(); ConnectorMetadata metadata = getMetadata(session, connectorId); Map<String, ColumnHandle> handles = metadata.getColumnHandles(session.toConnectorSession(connectorId), tableHandle.getConnectorHandle()); ImmutableMap.Builder<String, ColumnHandle> map = ImmutableMap.builder(); for (Entry<String, ColumnHandle> mapEntry : handles.entrySet()) { map.put(mapEntry.getKey().toLowerCase(ENGLISH), mapEntry.getValue()); } return map.build(); }
@BeforeClass public void setup() { metadata = getQueryRunner().getMetadata(); sqlParser = getQueryRunner().getSqlParser(); ConnectorId connectorId = getCurrentConnectorId(); nationTableHandle = new TableHandle( connectorId, new TpchTableHandle("nation", 1.0)); nationTableLayoutHandle = new TableLayoutHandle(connectorId, TestingTransactionHandle.create(), new TpchTableLayoutHandle((TpchTableHandle) nationTableHandle.getConnectorHandle(), TupleDomain.all())); }
@Override public Optional<TableHandle> getTableHandle(Session session, QualifiedObjectName table) { requireNonNull(table, "table is null"); Optional<CatalogMetadata> catalog = getOptionalCatalogMetadata(session, table.getCatalogName()); if (catalog.isPresent()) { CatalogMetadata catalogMetadata = catalog.get(); ConnectorId connectorId = catalogMetadata.getConnectorId(session, table); ConnectorMetadata metadata = catalogMetadata.getMetadataFor(connectorId); ConnectorTableHandle tableHandle = metadata.getTableHandle(session.toConnectorSession(connectorId), table.asSchemaTableName()); if (tableHandle != null) { return Optional.of(new TableHandle(connectorId, tableHandle)); } } return Optional.empty(); }
@Override public TableHandle beginDelete(Session session, TableHandle tableHandle) { ConnectorId connectorId = tableHandle.getConnectorId(); ConnectorMetadata metadata = getMetadataForWrite(session, connectorId); ConnectorTableHandle newHandle = metadata.beginDelete(session.toConnectorSession(connectorId), tableHandle.getConnectorHandle()); return new TableHandle(tableHandle.getConnectorId(), newHandle); }
Map<String, PropertyMetadata<?>> allColumnProperties = metadata.getColumnPropertyManager().getAllProperties().get(tableHandle.get().getConnectorId()); Map<String, PropertyMetadata<?>> allTableProperties = metadata.getTablePropertyManager().getAllProperties().get(tableHandle.get().getConnectorId()); List<Property> propertyNodes = buildProperties(objectName, Optional.empty(), INVALID_TABLE_PROPERTY, properties, allTableProperties);
@Override public Void visitTableScan(TableScanNode node, Integer indent) { ConnectorTableHandle connectorTableHandle = node.getTable().getConnectorHandle(); if (connectorTableHandle instanceof TpcdsTableHandle) { output(indent, "scan %s", ((TpcdsTableHandle) connectorTableHandle).getTableName()); } else if (connectorTableHandle instanceof TpchTableHandle) { output(indent, "scan %s", ((TpchTableHandle) connectorTableHandle).getTableName()); } else { throw new IllegalStateException(format("Unexpected ConnectorTableHandle: %s", connectorTableHandle.getClass())); } return null; }
@Override public String toString() { return handle.toString(); } }
@Override public void renameColumn(Session session, TableHandle tableHandle, ColumnHandle source, String target) { ConnectorId connectorId = tableHandle.getConnectorId(); ConnectorMetadata metadata = getMetadataForWrite(session, connectorId); metadata.renameColumn(session.toConnectorSession(connectorId), tableHandle.getConnectorHandle(), source, target.toLowerCase(ENGLISH)); }
@BeforeClass public void setup() { metadata = getQueryRunner().getMetadata(); builder = new PlanBuilder(new PlanNodeIdAllocator(), metadata); ConnectorId connectorId = getCurrentConnectorId(); TableHandle nationTableHandle = new TableHandle( connectorId, new TpchTableHandle("nation", 1.0)); TableLayoutHandle nationTableLayoutHandle = new TableLayoutHandle(connectorId, TestingTransactionHandle.create(), new TpchTableLayoutHandle((TpchTableHandle) nationTableHandle.getConnectorHandle(), TupleDomain.all())); TpchColumnHandle nationkeyColumnHandle = new TpchColumnHandle("nationkey", BIGINT); symbol = new Symbol("nationkey"); tableScanNode = builder.tableScan(nationTableHandle, ImmutableList.of(symbol), ImmutableMap.of(symbol, nationkeyColumnHandle), Optional.of(nationTableLayoutHandle)); }