Search in sources :

Example 1 with SystemTable

use of org.apache.drill.exec.store.sys.SystemTable in project drill by apache.

the class TestMetadataProvider method tablesWithTableNameFilter.

@Test
public void tablesWithTableNameFilter() throws Exception {
    // test("SELECT * FROM INFORMATION_SCHEMA.`TABLES` WHERE TABLE_NAME LIKE '%o%'"); // SQL equivalent
    GetTablesResp resp = client.getTables(null, null, LikeFilter.newBuilder().setPattern("%o%").build(), null).get();
    assertEquals(RequestStatus.OK, resp.getStatus());
    List<TableMetadata> tables = resp.getTablesList();
    assertEquals(12, tables.size());
    // Verify System Tables
    for (SystemTable sysTbl : SystemTable.values()) {
        String sysTblName = sysTbl.getTableName();
        if (sysTblName.contains("o")) {
            verifyTable("sys", sysTblName, 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 2 with SystemTable

use of org.apache.drill.exec.store.sys.SystemTable 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 3 with SystemTable

use of org.apache.drill.exec.store.sys.SystemTable 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

OptionsTest (org.apache.drill.categories.OptionsTest)3 GetTablesResp (org.apache.drill.exec.proto.UserProtos.GetTablesResp)3 TableMetadata (org.apache.drill.exec.proto.UserProtos.TableMetadata)3 SystemTable (org.apache.drill.exec.store.sys.SystemTable)3 Test (org.junit.Test)3