Search in sources :

Example 1 with MetadataDao

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;
    });
}
Also used : MetadataDao(io.trino.plugin.raptor.legacy.metadata.MetadataDao)

Example 2 with MetadataDao

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);
}
Also used : SchemaTableName(io.trino.spi.connector.SchemaTableName) MetadataDao(io.trino.plugin.raptor.legacy.metadata.MetadataDao) Test(org.testng.annotations.Test)

Example 3 with MetadataDao

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);
}
Also used : SchemaTableName(io.trino.spi.connector.SchemaTableName) MetadataDao(io.trino.plugin.raptor.legacy.metadata.MetadataDao) Test(org.testng.annotations.Test)

Example 4 with MetadataDao

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);
}
Also used : RaptorMetadata(io.trino.plugin.raptor.legacy.RaptorMetadata) MetadataDao(io.trino.plugin.raptor.legacy.metadata.MetadataDao) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 5 with MetadataDao

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);
}
Also used : DatabaseTesting.createTestingJdbi(io.trino.plugin.raptor.legacy.DatabaseTesting.createTestingJdbi) Jdbi(org.jdbi.v3.core.Jdbi) StorageManager(io.trino.plugin.raptor.legacy.storage.StorageManager) TestRaptorStorageManager.createRaptorStorageManager(io.trino.plugin.raptor.legacy.storage.TestRaptorStorageManager.createRaptorStorageManager) TestDatabaseShardManager.createShardManager(io.trino.plugin.raptor.legacy.metadata.TestDatabaseShardManager.createShardManager) ShardManager(io.trino.plugin.raptor.legacy.metadata.ShardManager) StorageManagerConfig(io.trino.plugin.raptor.legacy.storage.StorageManagerConfig) NodeManager(io.trino.spi.NodeManager) TestingNodeManager(io.trino.testing.TestingNodeManager) PagesIndexPageSorter(io.trino.operator.PagesIndexPageSorter) LifeCycleManager(io.airlift.bootstrap.LifeCycleManager) TestingNodeManager(io.trino.testing.TestingNodeManager) CatalogName(io.trino.plugin.base.CatalogName) MetadataDao(io.trino.plugin.raptor.legacy.metadata.MetadataDao) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

MetadataDao (io.trino.plugin.raptor.legacy.metadata.MetadataDao)11 Duration (io.airlift.units.Duration)3 ShardManager (io.trino.plugin.raptor.legacy.metadata.ShardManager)3 StorageManagerConfig (io.trino.plugin.raptor.legacy.storage.StorageManagerConfig)3 NodeManager (io.trino.spi.NodeManager)3 Jdbi (org.jdbi.v3.core.Jdbi)3 BeforeMethod (org.testng.annotations.BeforeMethod)3 ImmutableSet (com.google.common.collect.ImmutableSet)2 Threads.daemonThreadsNamed (io.airlift.concurrent.Threads.daemonThreadsNamed)2 Logger (io.airlift.log.Logger)2 ColumnInfo (io.trino.plugin.raptor.legacy.metadata.ColumnInfo)2 ForMetadata (io.trino.plugin.raptor.legacy.metadata.ForMetadata)2 ShardMetadata (io.trino.plugin.raptor.legacy.metadata.ShardMetadata)2 Table (io.trino.plugin.raptor.legacy.metadata.Table)2 ShardOrganizerUtil.getOrganizationEligibleShards (io.trino.plugin.raptor.legacy.storage.organization.ShardOrganizerUtil.getOrganizationEligibleShards)2 DatabaseUtil.onDemandDao (io.trino.plugin.raptor.legacy.util.DatabaseUtil.onDemandDao)2 SchemaTableName (io.trino.spi.connector.SchemaTableName)2 TestingNodeManager (io.trino.testing.TestingNodeManager)2 Collection (java.util.Collection)2 List (java.util.List)2