Search in sources :

Example 11 with FilterQuery

use of com.linkedin.pinot.common.request.FilterQuery in project pinot by linkedin.

the class QueryExecutorTest method getSumQuery.

private BrokerRequest getSumQuery() {
    BrokerRequest query = new BrokerRequest();
    AggregationInfo aggregationInfo = getSumAggregationInfo();
    List<AggregationInfo> aggregationsInfo = new ArrayList<AggregationInfo>();
    aggregationsInfo.add(aggregationInfo);
    query.setAggregationsInfo(aggregationsInfo);
    FilterQuery filterQuery = getFilterQuery();
    query.setFilterQuery(filterQuery);
    return query;
}
Also used : ArrayList(java.util.ArrayList) FilterQuery(com.linkedin.pinot.common.request.FilterQuery) BrokerRequest(com.linkedin.pinot.common.request.BrokerRequest) AggregationInfo(com.linkedin.pinot.common.request.AggregationInfo)

Example 12 with FilterQuery

use of com.linkedin.pinot.common.request.FilterQuery in project pinot by linkedin.

the class QueryExecutorTest method getMaxQuery.

private BrokerRequest getMaxQuery() {
    BrokerRequest query = new BrokerRequest();
    AggregationInfo aggregationInfo = getMaxAggregationInfo();
    List<AggregationInfo> aggregationsInfo = new ArrayList<AggregationInfo>();
    aggregationsInfo.add(aggregationInfo);
    query.setAggregationsInfo(aggregationsInfo);
    FilterQuery filterQuery = getFilterQuery();
    query.setFilterQuery(filterQuery);
    return query;
}
Also used : ArrayList(java.util.ArrayList) FilterQuery(com.linkedin.pinot.common.request.FilterQuery) BrokerRequest(com.linkedin.pinot.common.request.BrokerRequest) AggregationInfo(com.linkedin.pinot.common.request.AggregationInfo)

Example 13 with FilterQuery

use of com.linkedin.pinot.common.request.FilterQuery in project pinot by linkedin.

the class BrokerRequestOptimizer method optimizeFilterQueryTree.

/**
   * Optimizes the filter query tree of a broker request in place.
   * @param brokerRequest The broker request to optimize
   * @param timeColumn time column
   */
private void optimizeFilterQueryTree(BrokerRequest brokerRequest, String timeColumn, OptimizationFlags optimizationFlags) {
    FilterQueryTree filterQueryTree = null;
    FilterQuery q = brokerRequest.getFilterQuery();
    if (q == null || brokerRequest.getFilterSubQueryMap() == null) {
        return;
    }
    filterQueryTree = RequestUtils.buildFilterQuery(q.getId(), brokerRequest.getFilterSubQueryMap().getFilterQueryMap());
    FilterQueryOptimizerRequest.FilterQueryOptimizerRequestBuilder builder = new FilterQueryOptimizerRequest.FilterQueryOptimizerRequestBuilder();
    FilterQueryOptimizerRequest request = builder.setFilterQueryTree(filterQueryTree).setTimeColumn(timeColumn).build();
    if (optimizationFlags == null) {
        for (FilterQueryTreeOptimizer filterQueryTreeOptimizer : FILTER_QUERY_TREE_OPTIMIZERS) {
            filterQueryTree = filterQueryTreeOptimizer.optimize(request);
            // Optimizers may return a new tree instead of in-place optimization
            request.setFilterQueryTree(filterQueryTree);
        }
    } else {
        if (optimizationFlags.isOptimizationEnabled("filterQueryTree")) {
            for (FilterQueryTreeOptimizer filterQueryTreeOptimizer : FILTER_QUERY_TREE_OPTIMIZERS) {
                if (optimizationFlags.isOptimizationEnabled(filterQueryTreeOptimizer.getOptimizationName())) {
                    filterQueryTree = filterQueryTreeOptimizer.optimize(request);
                    // Optimizers may return a new tree instead of in-place optimization
                    request.setFilterQueryTree(filterQueryTree);
                }
            }
        }
    }
    RequestUtils.generateFilterFromTree(filterQueryTree, brokerRequest);
}
Also used : FilterQueryTree(com.linkedin.pinot.common.utils.request.FilterQueryTree) FilterQuery(com.linkedin.pinot.common.request.FilterQuery)

Example 14 with FilterQuery

use of com.linkedin.pinot.common.request.FilterQuery in project pinot by linkedin.

the class InstanceServerStarter method getMaxQuery.

private static BrokerRequest getMaxQuery() {
    BrokerRequest query = new BrokerRequest();
    AggregationInfo aggregationInfo = getMaxAggregationInfo();
    List<AggregationInfo> aggregationsInfo = new ArrayList<AggregationInfo>();
    aggregationsInfo.add(aggregationInfo);
    query.setAggregationsInfo(aggregationsInfo);
    FilterQuery filterQuery = getFilterQuery();
    query.setFilterQuery(filterQuery);
    return query;
}
Also used : ArrayList(java.util.ArrayList) FilterQuery(com.linkedin.pinot.common.request.FilterQuery) BrokerRequest(com.linkedin.pinot.common.request.BrokerRequest) AggregationInfo(com.linkedin.pinot.common.request.AggregationInfo)

Example 15 with FilterQuery

use of com.linkedin.pinot.common.request.FilterQuery in project pinot by linkedin.

the class InstanceServerStarter method getMinQuery.

private static BrokerRequest getMinQuery() {
    BrokerRequest query = new BrokerRequest();
    AggregationInfo aggregationInfo = getMinAggregationInfo();
    List<AggregationInfo> aggregationsInfo = new ArrayList<AggregationInfo>();
    aggregationsInfo.add(aggregationInfo);
    query.setAggregationsInfo(aggregationsInfo);
    FilterQuery filterQuery = getFilterQuery();
    query.setFilterQuery(filterQuery);
    return query;
}
Also used : ArrayList(java.util.ArrayList) FilterQuery(com.linkedin.pinot.common.request.FilterQuery) BrokerRequest(com.linkedin.pinot.common.request.BrokerRequest) AggregationInfo(com.linkedin.pinot.common.request.AggregationInfo)

Aggregations

FilterQuery (com.linkedin.pinot.common.request.FilterQuery)15 ArrayList (java.util.ArrayList)11 AggregationInfo (com.linkedin.pinot.common.request.AggregationInfo)9 BrokerRequest (com.linkedin.pinot.common.request.BrokerRequest)9 FilterQueryMap (com.linkedin.pinot.common.request.FilterQueryMap)3 GroupBy (com.linkedin.pinot.common.request.GroupBy)1 QuerySource (com.linkedin.pinot.common.request.QuerySource)1 QueryType (com.linkedin.pinot.common.request.QueryType)1 Selection (com.linkedin.pinot.common.request.Selection)1 SelectionSort (com.linkedin.pinot.common.request.SelectionSort)1 FilterQueryTree (com.linkedin.pinot.common.utils.request.FilterQueryTree)1 TimeBoundaryInfo (com.linkedin.pinot.routing.TimeBoundaryService.TimeBoundaryInfo)1 HashMap (java.util.HashMap)1 TSerializer (org.apache.thrift.TSerializer)1 TCompactProtocol (org.apache.thrift.protocol.TCompactProtocol)1 Test (org.testng.annotations.Test)1