use of org.apache.drill.BaseTestQuery.SilentListener 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();
}
Aggregations