use of org.apache.drill.test.TestBuilder in project drill by apache.
the class TestInfoSchema method showTablesFromDb.
@Test
public void showTablesFromDb() throws Exception {
List<String[]> expected = Arrays.asList(new String[] { "information_schema", "VIEWS" }, new String[] { "information_schema", "COLUMNS" }, new String[] { "information_schema", "TABLES" }, new String[] { "information_schema", "CATALOGS" }, new String[] { "information_schema", "SCHEMATA" }, new String[] { "information_schema", "FILES" }, new String[] { "information_schema", "PARTITIONS" });
TestBuilder t1 = testBuilder().sqlQuery("SHOW TABLES FROM INFORMATION_SCHEMA").unOrdered().baselineColumns("TABLE_SCHEMA", "TABLE_NAME");
for (String[] expectedRow : expected) {
t1.baselineValues(expectedRow);
}
t1.go();
TestBuilder t2 = testBuilder().sqlQuery("SHOW TABLES IN INFORMATION_SCHEMA").unOrdered().baselineColumns("TABLE_SCHEMA", "TABLE_NAME");
for (String[] expectedRow : expected) {
t2.baselineValues(expectedRow);
}
t2.go();
}
use of org.apache.drill.test.TestBuilder in project drill by apache.
the class TestBaseViewSupport method queryViewHelper.
/**
* Execute the given query and check against the given baseline.
*
* @param query
* @param baselineColumns
* @param baselineValues
* @throws Exception
*/
protected static void queryViewHelper(final String query, final String[] baselineColumns, final List<Object[]> baselineValues) throws Exception {
TestBuilder testBuilder = testBuilder().sqlQuery(query).unOrdered().baselineColumns(baselineColumns);
for (Object[] values : baselineValues) {
testBuilder = testBuilder.baselineValues(values);
}
testBuilder.go();
}
use of org.apache.drill.test.TestBuilder in project drill by apache.
the class BaseTestHiveImpersonation method showTablesHelper.
protected void showTablesHelper(final String db, List<String> expectedTables) throws Exception {
final String dbQualified = hivePluginName + "." + db;
final TestBuilder testBuilder = testBuilder().sqlQuery("SHOW TABLES IN " + dbQualified).unOrdered().baselineColumns("TABLE_SCHEMA", "TABLE_NAME");
if (expectedTables.size() == 0) {
testBuilder.expectsEmptyResultSet();
} else {
for (String tbl : expectedTables) {
testBuilder.baselineValues(dbQualified, tbl);
}
}
testBuilder.go();
}
use of org.apache.drill.test.TestBuilder in project drill by apache.
the class BaseTestHiveImpersonation method fromInfoSchemaHelper.
protected void fromInfoSchemaHelper(final String db, List<String> expectedTables, List<TableType> expectedTableTypes) throws Exception {
final String dbQualified = hivePluginName + "." + db;
final TestBuilder testBuilder = testBuilder().sqlQuery("SELECT TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE \n" + "FROM INFORMATION_SCHEMA.`TABLES` \n" + "WHERE TABLE_SCHEMA = '" + dbQualified + "'").unOrdered().baselineColumns("TABLE_SCHEMA", "TABLE_NAME", "TABLE_TYPE");
if (expectedTables.size() == 0) {
testBuilder.expectsEmptyResultSet();
} else {
for (int i = 0; i < expectedTables.size(); ++i) {
testBuilder.baselineValues(dbQualified, expectedTables.get(i), expectedTableTypes.get(i).toString());
}
}
testBuilder.go();
}
Aggregations