Search in sources :

Example 11 with MetadataDao

use of com.facebook.presto.raptor.metadata.MetadataDao in project presto by prestodb.

the class TestShardOrganizationManager method setup.

@BeforeMethod
public void setup() {
    dbi = new DBI("jdbc:h2:mem:test" + System.nanoTime());
    dummyHandle = dbi.open();
    metadataDao = dbi.onDemand(MetadataDao.class);
    organizerDao = dbi.onDemand(ShardOrganizerDao.class);
    createTablesWithRetry(dbi);
}
Also used : IDBI(org.skife.jdbi.v2.IDBI) DBI(org.skife.jdbi.v2.DBI) MetadataDao(com.facebook.presto.raptor.metadata.MetadataDao) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 12 with MetadataDao

use of com.facebook.presto.raptor.metadata.MetadataDao in project presto by prestodb.

the class TestShardMetadataRecordCursor method testNoTableFilter.

@Test
public void testNoTableFilter() throws Exception {
    // Create "orders" table in a different schema
    metadata.createTable(SESSION, tableMetadataBuilder(new SchemaTableName("test", "orders2")).column("orderkey", BIGINT).build());
    // Create another table that should not be selected
    metadata.createTable(SESSION, 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"))).build());
    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(com.facebook.presto.spi.SchemaTableName) MetadataDao(com.facebook.presto.raptor.metadata.MetadataDao) Test(org.testng.annotations.Test)

Aggregations

MetadataDao (com.facebook.presto.raptor.metadata.MetadataDao)12 ShardManager (com.facebook.presto.raptor.metadata.ShardManager)3 TableColumn (com.facebook.presto.raptor.metadata.TableColumn)3 StorageManagerConfig (com.facebook.presto.raptor.storage.StorageManagerConfig)3 NodeManager (com.facebook.presto.spi.NodeManager)3 TypeRegistry (com.facebook.presto.type.TypeRegistry)3 Duration (io.airlift.units.Duration)3 DBI (org.skife.jdbi.v2.DBI)3 BeforeMethod (org.testng.annotations.BeforeMethod)3 ColumnInfo (com.facebook.presto.raptor.metadata.ColumnInfo)2 ForMetadata (com.facebook.presto.raptor.metadata.ForMetadata)2 ShardMetadata (com.facebook.presto.raptor.metadata.ShardMetadata)2 Table (com.facebook.presto.raptor.metadata.Table)2 ShardOrganizerUtil.getOrganizationEligibleShards (com.facebook.presto.raptor.storage.organization.ShardOrganizerUtil.getOrganizationEligibleShards)2 DatabaseUtil.onDemandDao (com.facebook.presto.raptor.util.DatabaseUtil.onDemandDao)2 SchemaTableName (com.facebook.presto.spi.SchemaTableName)2 TestingNodeManager (com.facebook.presto.testing.TestingNodeManager)2 ImmutableSet (com.google.common.collect.ImmutableSet)2 Threads.daemonThreadsNamed (io.airlift.concurrent.Threads.daemonThreadsNamed)2 Logger (io.airlift.log.Logger)2