Search in sources :

Example 1 with Schema

use of alluxio.grpc.table.Schema in project alluxio by Alluxio.

the class AlluxioCatalogTest method testGetColumnStats.

@Test
public void testGetColumnStats() throws Exception {
    Schema s = schemaFromColNames("c1", "c2", "c3");
    // setup
    // Why does this API seem so counter intuitive?
    UdbTable tbl = createMockUdbTable("test", s);
    Database db = createMockDatabase("noop", "test", Collections.emptyList());
    addTableToDb(db, Table.create(db, tbl, null));
    addDbToCatalog(db);
    // basic, filter on each col
    assertEquals(1, mCatalog.getTableColumnStatistics("test", "test", Lists.newArrayList("c1")).size());
    assertEquals(1, mCatalog.getTableColumnStatistics("test", "test", Lists.newArrayList("c2")).size());
    assertEquals(1, mCatalog.getTableColumnStatistics("test", "test", Lists.newArrayList("c3")).size());
    // try two
    assertEquals(2, mCatalog.getTableColumnStatistics("test", "test", Lists.newArrayList("c1", "c2")).size());
    // flip order
    assertEquals(2, mCatalog.getTableColumnStatistics("test", "test", Lists.newArrayList("c2", "c1")).size());
    // non existing
    assertEquals(0, mCatalog.getTableColumnStatistics("test", "test", Lists.newArrayList("doesnotexist")).size());
    // empty
    assertEquals(0, mCatalog.getTableColumnStatistics("test", "test", Lists.newArrayList()).size());
}
Also used : UdbTable(alluxio.table.common.udb.UdbTable) Schema(alluxio.grpc.table.Schema) FieldSchema(alluxio.grpc.table.FieldSchema) Test(org.junit.Test)

Example 2 with Schema

use of alluxio.grpc.table.Schema 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 3 with Schema

use of alluxio.grpc.table.Schema 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)

Aggregations

FieldSchema (alluxio.grpc.table.FieldSchema)3 Schema (alluxio.grpc.table.Schema)3 UdbTable (alluxio.table.common.udb.UdbTable)3 Test (org.junit.Test)3