use of alluxio.table.common.udb.UdbTable in project alluxio by Alluxio.
the class AlluxioCatalogTest method testGetPartitionUnpartitonedUdbTable.
@Test
public void testGetPartitionUnpartitonedUdbTable() throws Exception {
Schema s = schemaFromColNames("c1", "c2", "c3");
// setup
UdbTable tbl = createMockUdbTable("test", s);
Database db = createMockDatabase("noop", "test", Collections.emptyList());
addTableToDb(db, Table.create(db, tbl, null));
addDbToCatalog(db);
assertEquals(1, mCatalog.getTable("test", "test").getPartitions().size());
}
use of alluxio.table.common.udb.UdbTable in project alluxio by Alluxio.
the class AlluxioCatalogTest method testGetPartitionPartitonedUdbTable.
@Test
public void testGetPartitionPartitonedUdbTable() throws Exception {
Schema s = schemaFromColNames("c1", "c2", "c3");
// setup
UdbTable tbl = createMockPartitionedUdbTable("test", s);
Database db = createMockDatabase("noop", "test", Collections.emptyList());
addTableToDb(db, Table.create(db, tbl, null));
addDbToCatalog(db);
assertEquals(2, mCatalog.getTable("test", "test").getPartitions().size());
}
use of alluxio.table.common.udb.UdbTable in project alluxio by Alluxio.
the class AlluxioCatalogTest method createMockPartitionedUdbTable.
UdbTable createMockPartitionedUdbTable(String name, Schema schema) throws IOException {
UdbPartition partition = Mockito.mock(UdbPartition.class);
when(partition.getSpec()).thenReturn(name);
when(partition.getLayout()).thenReturn(new HiveLayout(PartitionInfo.getDefaultInstance(), Collections.emptyList()));
UdbTable tbl = Mockito.mock(UdbTable.class);
when(tbl.getName()).thenReturn(name);
when(tbl.getSchema()).thenReturn(schema);
when(tbl.getStatistics()).thenReturn(createRandomStatsForSchema(schema));
when(tbl.getPartitions()).thenReturn(Arrays.asList(partition, partition));
when(tbl.getPartitionCols()).thenReturn(Arrays.asList(FieldSchema.getDefaultInstance()));
when(tbl.getLayout()).thenReturn(new HiveLayout(PartitionInfo.getDefaultInstance(), Collections.emptyList()).toProto());
return tbl;
}
Aggregations