use of org.apache.drill.exec.client.PrintingResultsListener in project drill by apache.
the class QueryTestUtil method testRunAndPrint.
/**
* Execute a SQL query, and print the results.
*
* @param drillClient drill client to use
* @param type type of the query
* @param queryString query string
* @return number of rows returned
* @throws Exception
*/
public static int testRunAndPrint(final DrillClient drillClient, final QueryType type, final String queryString) throws Exception {
final String query = normalizeQuery(queryString);
DrillConfig config = drillClient.getConfig();
AwaitableUserResultsListener resultListener = new AwaitableUserResultsListener(config.getBoolean(TEST_QUERY_PRINTING_SILENT) ? new SilentListener() : new PrintingResultsListener(config, Format.TSV, VectorUtil.DEFAULT_COLUMN_WIDTH));
drillClient.runQuery(type, query, resultListener);
return resultListener.await();
}
use of org.apache.drill.exec.client.PrintingResultsListener in project drill by apache.
the class DrillSeparatePlanningTest method testPlanning.
@Test(timeout = 30000)
public void testPlanning() throws Exception {
final String query = String.format("SELECT dir0, columns[3] FROM dfs_test.`%s/multilevel/csv` order by dir0", TEST_RES_PATH);
updateTestCluster(2, config);
List<QueryDataBatch> results = client.runQuery(QueryType.SQL, "alter session set `planner.slice_target`=1");
for (QueryDataBatch batch : results) {
batch.release();
}
AwaitableUserResultsListener listener = new AwaitableUserResultsListener(new PrintingResultsListener(client.getConfig(), Format.TSV, VectorUtil.DEFAULT_COLUMN_WIDTH));
//AwaitableUserResultsListener listener =
// new AwaitableUserResultsListener(new SilentListener());
client.runQuery(QueryType.SQL, query, listener);
@SuppressWarnings("unused") int rows = listener.await();
}
Aggregations