Search in sources :

Example 11 with GroupBy

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

the class SelectAstNode method updateBrokerRequest.

@Override
public void updateBrokerRequest(BrokerRequest brokerRequest) {
    // Set the query source
    QuerySource querySource = new QuerySource();
    querySource.setTableName(_resourceName);
    brokerRequest.setQuerySource(querySource);
    sendBrokerRequestUpdateToChildren(brokerRequest);
    // If there is a selection, set its limit if applicable
    Selection selections = brokerRequest.getSelections();
    if (selections != null) {
        if (_recordLimit != -1) {
            selections.setSize(_recordLimit);
        }
        if (_offset != -1) {
            selections.setOffset(_offset);
        }
    }
    // If there is a topN clause, set it on the group by
    GroupBy groupBy = brokerRequest.getGroupBy();
    if (groupBy != null) {
        if (_topN != -1) {
            groupBy.setTopN(_topN);
        } else {
            // Pinot quirk: default to top 10
            groupBy.setTopN(10);
        }
    }
    // Pinot quirk: if there is both a selection and an aggregation, remove the selection
    if (brokerRequest.getAggregationsInfoSize() != 0 && brokerRequest.isSetSelections()) {
        brokerRequest.setSelections(null);
    }
}
Also used : GroupBy(com.linkedin.pinot.common.request.GroupBy) Selection(com.linkedin.pinot.common.request.Selection) QuerySource(com.linkedin.pinot.common.request.QuerySource)

Aggregations

GroupBy (com.linkedin.pinot.common.request.GroupBy)11 AggregationInfo (com.linkedin.pinot.common.request.AggregationInfo)6 BrokerRequest (com.linkedin.pinot.common.request.BrokerRequest)4 HashSet (java.util.HashSet)3 QuerySource (com.linkedin.pinot.common.request.QuerySource)2 Selection (com.linkedin.pinot.common.request.Selection)2 FilterQueryTree (com.linkedin.pinot.common.utils.request.FilterQueryTree)2 Pql2Compiler (com.linkedin.pinot.pql.parsers.Pql2Compiler)2 ArrayList (java.util.ArrayList)2 FilterQuery (com.linkedin.pinot.common.request.FilterQuery)1 FilterQueryMap (com.linkedin.pinot.common.request.FilterQueryMap)1 QueryType (com.linkedin.pinot.common.request.QueryType)1 SelectionSort (com.linkedin.pinot.common.request.SelectionSort)1 StarTreeMetadata (com.linkedin.pinot.common.segment.StarTreeMetadata)1 Operator (com.linkedin.pinot.core.common.Operator)1 BReusableFilteredDocIdSetOperator (com.linkedin.pinot.core.operator.BReusableFilteredDocIdSetOperator)1 BaseOperator (com.linkedin.pinot.core.operator.BaseOperator)1 MProjectionOperator (com.linkedin.pinot.core.operator.MProjectionOperator)1 IntermediateResultsBlock (com.linkedin.pinot.core.operator.blocks.IntermediateResultsBlock)1 MatchEntireSegmentOperator (com.linkedin.pinot.core.operator.filter.MatchEntireSegmentOperator)1