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);
}
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);
}
Aggregations