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);
}
}
Aggregations