use of io.trino.plugin.raptor.legacy.metadata.MetadataDao in project trino by trinodb.
the class RaptorMetadata method renameTable.
@Override
public void renameTable(ConnectorSession session, ConnectorTableHandle tableHandle, SchemaTableName newTableName) {
RaptorTableHandle table = (RaptorTableHandle) tableHandle;
runTransaction(dbi, handle -> {
MetadataDao dao = handle.attach(MetadataDao.class);
dao.renameTable(table.getTableId(), newTableName.getSchemaName(), newTableName.getTableName());
return null;
});
}
use of io.trino.plugin.raptor.legacy.metadata.MetadataDao in project trino by trinodb.
the class TestShardMetadataRecordCursor method testNoSchemaFilter.
@Test
public void testNoSchemaFilter() {
// Create "orders" table in a different schema
createTable(tableMetadataBuilder(new SchemaTableName("other", "orders")).column("orderkey", BIGINT).build());
// Create another table that should not be selected
createTable(tableMetadataBuilder(new SchemaTableName("schema1", "foo")).column("orderkey", BIGINT).build());
TupleDomain<Integer> tupleDomain = TupleDomain.withColumnDomains(ImmutableMap.<Integer, Domain>builder().put(1, Domain.singleValue(createVarcharType(10), utf8Slice("orders"))).buildOrThrow());
MetadataDao metadataDao = dummyHandle.attach(MetadataDao.class);
Set<Long> actual = ImmutableSet.copyOf(ShardMetadataRecordCursor.getTableIds(dbi, tupleDomain));
Set<Long> expected = ImmutableSet.of(metadataDao.getTableInformation("other", "orders").getTableId(), metadataDao.getTableInformation("test", "orders").getTableId());
assertEquals(actual, expected);
}
use of io.trino.plugin.raptor.legacy.metadata.MetadataDao in project trino by trinodb.
the class TestShardMetadataRecordCursor method testNoTableFilter.
@Test
public void testNoTableFilter() {
// Create "orders" table in a different schema
createTable(tableMetadataBuilder(new SchemaTableName("test", "orders2")).column("orderkey", BIGINT).build());
// Create another table that should not be selected
createTable(tableMetadataBuilder(new SchemaTableName("schema1", "foo")).column("orderkey", BIGINT).build());
TupleDomain<Integer> tupleDomain = TupleDomain.withColumnDomains(ImmutableMap.<Integer, Domain>builder().put(0, Domain.singleValue(createVarcharType(10), utf8Slice("test"))).buildOrThrow());
MetadataDao metadataDao = dummyHandle.attach(MetadataDao.class);
Set<Long> actual = ImmutableSet.copyOf(ShardMetadataRecordCursor.getTableIds(dbi, tupleDomain));
Set<Long> expected = ImmutableSet.of(metadataDao.getTableInformation("test", "orders").getTableId(), metadataDao.getTableInformation("test", "orders2").getTableId());
assertEquals(actual, expected);
}
use of io.trino.plugin.raptor.legacy.metadata.MetadataDao in project trino by trinodb.
the class TestShardOrganizerUtil method setup.
@BeforeMethod
public void setup() {
dbi = createTestingJdbi();
dummyHandle = dbi.open();
createTablesWithRetry(dbi);
dataDir = Files.createTempDir();
metadata = new RaptorMetadata(dbi, createShardManager(dbi));
metadataDao = dbi.onDemand(MetadataDao.class);
shardManager = createShardManager(dbi);
}
use of io.trino.plugin.raptor.legacy.metadata.MetadataDao in project trino by trinodb.
the class TestRaptorConnector method setup.
@BeforeMethod
public void setup() {
Jdbi dbi = createTestingJdbi();
dummyHandle = dbi.open();
metadataDao = dbi.onDemand(MetadataDao.class);
createTablesWithRetry(dbi);
dataDir = Files.createTempDir();
CatalogName connectorId = new CatalogName("test");
NodeManager nodeManager = new TestingNodeManager();
NodeSupplier nodeSupplier = nodeManager::getWorkerNodes;
ShardManager shardManager = createShardManager(dbi);
StorageManager storageManager = createRaptorStorageManager(dbi, dataDir);
StorageManagerConfig config = new StorageManagerConfig();
connector = new RaptorConnector(new LifeCycleManager(ImmutableList.of(), null), new TestingNodeManager(), new RaptorMetadataFactory(dbi, shardManager), new RaptorSplitManager(connectorId, nodeSupplier, shardManager, false), new RaptorPageSourceProvider(storageManager), new RaptorPageSinkProvider(storageManager, new PagesIndexPageSorter(new PagesIndex.TestingFactory(false)), config), new RaptorNodePartitioningProvider(nodeSupplier), new RaptorSessionProperties(config), new RaptorTableProperties(TESTING_TYPE_MANAGER), ImmutableSet.of(), Optional.empty(), dbi);
}
Aggregations