public static TableLayout fromConnectorLayout(ConnectorId connectorId, ConnectorTransactionHandle transactionHandle, ConnectorTableLayout layout) { return new TableLayout(new TableLayoutHandle(connectorId, transactionHandle, layout.getHandle()), layout); }
public static TableLayout fromConnectorLayout(ConnectorId connectorId, ConnectorTransactionHandle transactionHandle, ConnectorTableLayout layout) { return new TableLayout(new TableLayoutHandle(connectorId, transactionHandle, layout.getHandle()), layout); }
@Override public TableLayoutHandle getAlternativeLayoutHandle(Session session, TableLayoutHandle tableLayoutHandle, PartitioningHandle partitioningHandle) { checkArgument(partitioningHandle.getConnectorId().isPresent(), "Expect partitioning handle from connector, got system partitioning handle"); ConnectorId connectorId = partitioningHandle.getConnectorId().get(); checkArgument(connectorId.equals(tableLayoutHandle.getConnectorId()), "ConnectorId of tableLayoutHandle and partitioningHandle does not match"); CatalogMetadata catalogMetadata = getCatalogMetadata(session, connectorId); ConnectorMetadata metadata = catalogMetadata.getMetadataFor(connectorId); ConnectorTransactionHandle transaction = catalogMetadata.getTransactionHandleFor(connectorId); ConnectorTableLayoutHandle newTableLayoutHandle = metadata.getAlternativeLayoutHandle(session.toConnectorSession(connectorId), tableLayoutHandle.getConnectorHandle(), partitioningHandle.getConnectorHandle()); return new TableLayoutHandle(connectorId, transaction, newTableLayoutHandle); }
@Override public TableLayoutHandle getAlternativeLayoutHandle(Session session, TableLayoutHandle tableLayoutHandle, PartitioningHandle partitioningHandle) { checkArgument(partitioningHandle.getConnectorId().isPresent(), "Expect partitioning handle from connector, got system partitioning handle"); ConnectorId connectorId = partitioningHandle.getConnectorId().get(); checkArgument(connectorId.equals(tableLayoutHandle.getConnectorId()), "ConnectorId of tableLayoutHandle and partitioningHandle does not match"); CatalogMetadata catalogMetadata = getCatalogMetadata(session, connectorId); ConnectorMetadata metadata = catalogMetadata.getMetadataFor(connectorId); ConnectorTransactionHandle transaction = catalogMetadata.getTransactionHandleFor(connectorId); ConnectorTableLayoutHandle newTableLayoutHandle = metadata.getAlternativeLayoutHandle(session.toConnectorSession(connectorId), tableLayoutHandle.getConnectorHandle(), partitioningHandle.getConnectorHandle()); return new TableLayoutHandle(connectorId, transaction, newTableLayoutHandle); }
private TableScanNode tableScan(String id, String... symbols) { List<Symbol> symbolsList = Arrays.stream(symbols).map(Symbol::new).collect(toImmutableList()); ImmutableMap.Builder<Symbol, ColumnHandle> assignments = ImmutableMap.builder(); for (Symbol symbol : symbolsList) { assignments.put(symbol, new TpchColumnHandle("orderkey", BIGINT)); } TpchTableHandle tableHandle = new TpchTableHandle("orders", 1.0); return new TableScanNode( new PlanNodeId(id), new TableHandle(new ConnectorId("tpch"), new TpchTableHandle("orders", 1.0)), symbolsList, assignments.build(), Optional.of(new TableLayoutHandle(new ConnectorId("tpch"), INSTANCE, new TpchTableLayoutHandle(tableHandle, TupleDomain.all()))), TupleDomain.all(), TupleDomain.all()); }
private TableScanNode tableScan(String id, String... symbols) { List<Symbol> symbolsList = Arrays.stream(symbols).map(Symbol::new).collect(toImmutableList()); ImmutableMap.Builder<Symbol, ColumnHandle> assignments = ImmutableMap.builder(); for (Symbol symbol : symbolsList) { assignments.put(symbol, new TpchColumnHandle("orderkey", BIGINT)); } TpchTableHandle tableHandle = new TpchTableHandle("orders", 1.0); return new TableScanNode( new PlanNodeId(id), new TableHandle(new ConnectorId("tpch"), new TpchTableHandle("orders", 1.0)), symbolsList, assignments.build(), Optional.of(new TableLayoutHandle(new ConnectorId("tpch"), INSTANCE, new TpchTableLayoutHandle(tableHandle, TupleDomain.all()))), TupleDomain.all(), TupleDomain.all()); }
@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)); }
@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)); }
@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())); }
@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())); }
@BeforeClass public void setUpBeforeClass() { pickTableLayout = new PickTableLayout(tester().getMetadata(), new SqlParser()); connectorId = tester().getCurrentConnectorId(); nationTableHandle = new TableHandle( connectorId, new TpchTableHandle("nation", 1.0)); ordersTableHandle = new TableHandle( connectorId, new TpchTableHandle("orders", 1.0)); nationTableLayoutHandle = new TableLayoutHandle( connectorId, TestingTransactionHandle.create(), new TpchTableLayoutHandle((TpchTableHandle) nationTableHandle.getConnectorHandle(), TupleDomain.all())); ordersTableLayoutHandle = new TableLayoutHandle( connectorId, TestingTransactionHandle.create(), new TpchTableLayoutHandle((TpchTableHandle) ordersTableHandle.getConnectorHandle(), TupleDomain.all())); }
@BeforeClass public void setUpBeforeClass() { pickTableLayout = new PickTableLayout(tester().getMetadata(), new SqlParser()); connectorId = tester().getCurrentConnectorId(); nationTableHandle = new TableHandle( connectorId, new TpchTableHandle("nation", 1.0)); ordersTableHandle = new TableHandle( connectorId, new TpchTableHandle("orders", 1.0)); nationTableLayoutHandle = new TableLayoutHandle( connectorId, TestingTransactionHandle.create(), new TpchTableLayoutHandle((TpchTableHandle) nationTableHandle.getConnectorHandle(), TupleDomain.all())); ordersTableLayoutHandle = new TableLayoutHandle( connectorId, TestingTransactionHandle.create(), new TpchTableLayoutHandle((TpchTableHandle) ordersTableHandle.getConnectorHandle(), TupleDomain.all())); }