Search in sources :

Example 11 with TableMetadata

use of org.apache.drill.exec.proto.UserProtos.TableMetadata in project drill by apache.

the class TestMetadataProvider method tables.

@Test
public void tables() throws Exception {
    // test("SELECT * FROM INFORMATION_SCHEMA.`TABLES`"); // SQL equivalent
    GetTablesResp resp = client.getTables(null, null, null, null).get();
    assertEquals(RequestStatus.OK, resp.getStatus());
    List<TableMetadata> tables = resp.getTablesList();
    assertEquals(22, tables.size());
    verifyTable("information_schema", "CATALOGS", tables);
    verifyTable("information_schema", "COLUMNS", tables);
    verifyTable("information_schema", "SCHEMATA", tables);
    verifyTable("information_schema", "TABLES", tables);
    verifyTable("information_schema", "VIEWS", tables);
    verifyTable("information_schema", "PARTITIONS", tables);
    verifyTable("information_schema", "FILES", tables);
    // Verify System Tables
    for (SystemTable sysTbl : SystemTable.values()) {
        verifyTable("sys", sysTbl.getTableName(), tables);
    }
}
Also used : TableMetadata(org.apache.drill.exec.proto.UserProtos.TableMetadata) GetTablesResp(org.apache.drill.exec.proto.UserProtos.GetTablesResp) SystemTable(org.apache.drill.exec.store.sys.SystemTable) Test(org.junit.Test) OptionsTest(org.apache.drill.categories.OptionsTest)

Example 12 with TableMetadata

use of org.apache.drill.exec.proto.UserProtos.TableMetadata in project drill by apache.

the class TestMetadataProvider method tablesWithSystemTableFilter.

@Test
public void tablesWithSystemTableFilter() throws Exception {
    // test("SELECT * FROM INFORMATION_SCHEMA.`TABLES` WHERE TABLE_TYPE IN ('SYSTEM_TABLE')"); // SQL equivalent
    GetTablesResp resp = client.getTables(null, null, null, Collections.singletonList("SYSTEM TABLE")).get();
    assertEquals(RequestStatus.OK, resp.getStatus());
    List<TableMetadata> tables = resp.getTablesList();
    assertEquals(22, tables.size());
    verifyTable("information_schema", "CATALOGS", tables);
    verifyTable("information_schema", "COLUMNS", tables);
    verifyTable("information_schema", "SCHEMATA", tables);
    verifyTable("information_schema", "TABLES", tables);
    verifyTable("information_schema", "VIEWS", tables);
    verifyTable("information_schema", "PARTITIONS", tables);
    verifyTable("information_schema", "FILES", tables);
    // Verify System Tables
    for (SystemTable sysTbl : SystemTable.values()) {
        verifyTable("sys", sysTbl.getTableName(), tables);
    }
}
Also used : TableMetadata(org.apache.drill.exec.proto.UserProtos.TableMetadata) GetTablesResp(org.apache.drill.exec.proto.UserProtos.GetTablesResp) SystemTable(org.apache.drill.exec.store.sys.SystemTable) Test(org.junit.Test) OptionsTest(org.apache.drill.categories.OptionsTest)

Aggregations

GetTablesResp (org.apache.drill.exec.proto.UserProtos.GetTablesResp)12 TableMetadata (org.apache.drill.exec.proto.UserProtos.TableMetadata)12 OptionsTest (org.apache.drill.categories.OptionsTest)10 Test (org.junit.Test)10 SystemTable (org.apache.drill.exec.store.sys.SystemTable)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 MetaImpl (org.apache.calcite.avatica.MetaImpl)2 DrillPBError (org.apache.drill.exec.proto.UserBitShared.DrillPBError)2 LikeFilter (org.apache.drill.exec.proto.UserProtos.LikeFilter)2 RequestStatus (org.apache.drill.exec.proto.UserProtos.RequestStatus)2