Search in sources :

Example 1 with SilentListener

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();
}
Also used : AwaitableUserResultsListener(org.apache.drill.exec.rpc.user.AwaitableUserResultsListener) SilentListener(org.apache.drill.BaseTestQuery.SilentListener) DrillConfig(org.apache.drill.common.config.DrillConfig) PrintingResultsListener(org.apache.drill.exec.client.PrintingResultsListener)

Aggregations

SilentListener (org.apache.drill.BaseTestQuery.SilentListener)1 DrillConfig (org.apache.drill.common.config.DrillConfig)1 PrintingResultsListener (org.apache.drill.exec.client.PrintingResultsListener)1 AwaitableUserResultsListener (org.apache.drill.exec.rpc.user.AwaitableUserResultsListener)1