Search in sources :

Example 1 with QueryData

use of com.facebook.presto.client.QueryData in project presto by prestodb.

the class TableNameCompleter method queryMetadata.

private List<String> queryMetadata(String query) {
    ImmutableList.Builder<String> cache = ImmutableList.builder();
    try (StatementClient client = queryRunner.startInternalQuery(query)) {
        while (client.isRunning() && !Thread.currentThread().isInterrupted()) {
            QueryData results = client.currentData();
            if (results.getData() != null) {
                for (List<Object> row : results.getData()) {
                    cache.add((String) row.get(0));
                }
            }
            client.advance();
        }
    }
    return cache.build();
}
Also used : QueryData(com.facebook.presto.client.QueryData) ImmutableList(com.google.common.collect.ImmutableList) StatementClient(com.facebook.presto.client.StatementClient)

Aggregations

QueryData (com.facebook.presto.client.QueryData)1 StatementClient (com.facebook.presto.client.StatementClient)1 ImmutableList (com.google.common.collect.ImmutableList)1