Search in sources :

Example 6 with UdbTable

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());
}
Also used : UdbTable(alluxio.table.common.udb.UdbTable) Schema(alluxio.grpc.table.Schema) FieldSchema(alluxio.grpc.table.FieldSchema) Test(org.junit.Test)

Example 7 with UdbTable

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());
}
Also used : UdbTable(alluxio.table.common.udb.UdbTable) Schema(alluxio.grpc.table.Schema) FieldSchema(alluxio.grpc.table.FieldSchema) Test(org.junit.Test)

Example 8 with UdbTable

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;
}
Also used : UdbTable(alluxio.table.common.udb.UdbTable) HiveLayout(alluxio.table.common.layout.HiveLayout) UdbPartition(alluxio.table.common.UdbPartition)

Aggregations

UdbTable (alluxio.table.common.udb.UdbTable)8 UdbPartition (alluxio.table.common.UdbPartition)4 HiveLayout (alluxio.table.common.layout.HiveLayout)4 NotFoundException (alluxio.exception.status.NotFoundException)3 FieldSchema (alluxio.grpc.table.FieldSchema)3 Schema (alluxio.grpc.table.Schema)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)3 ColumnStatisticsInfo (alluxio.grpc.table.ColumnStatisticsInfo)2 Layout (alluxio.grpc.table.Layout)2 PartitionInfo (alluxio.grpc.table.layout.hive.PartitionInfo)2 PathTranslator (alluxio.table.common.udb.PathTranslator)2 UnderDatabase (alluxio.table.common.udb.UnderDatabase)2 HashMap (java.util.HashMap)2 List (java.util.List)2 AlluxioURI (alluxio.AlluxioURI)1 AlluxioException (alluxio.exception.AlluxioException)1 SyncStatus (alluxio.grpc.table.SyncStatus)1 DatabaseInfo (alluxio.master.table.DatabaseInfo)1