Search in sources :

Example 1 with Connection

use of com.linkedin.pinot.client.Connection in project pinot by linkedin.

the class ResultSetGroupCacheLoader method load.

@Override
public ResultSetGroup load(PinotQuery pinotQuery) throws Exception {
    try {
        Connection connection = getConnection();
        synchronized (connection) {
            long start = System.currentTimeMillis();
            ResultSetGroup resultSetGroup = connection.execute(pinotQuery.getTableName(), pinotQuery.getPql());
            if (LOG.isDebugEnabled()) {
                LOG.debug("Query:{}  response:{}", pinotQuery.getPql(), format(resultSetGroup));
            }
            long end = System.currentTimeMillis();
            LOG.info("Query:{}  took:{} ms", pinotQuery.getPql(), (end - start));
            return resultSetGroup;
        }
    } catch (PinotClientException cause) {
        LOG.error("Error when running pql:" + pinotQuery.getPql(), cause);
        throw new PinotClientException("Error when running pql:" + pinotQuery.getPql(), cause);
    }
}
Also used : Connection(com.linkedin.pinot.client.Connection) PinotClientException(com.linkedin.pinot.client.PinotClientException) ResultSetGroup(com.linkedin.pinot.client.ResultSetGroup)

Aggregations

Connection (com.linkedin.pinot.client.Connection)1 PinotClientException (com.linkedin.pinot.client.PinotClientException)1 ResultSetGroup (com.linkedin.pinot.client.ResultSetGroup)1