Search in sources :

Example 26 with AggregationInfo

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

the class SegmentQueryProcessor method pruneSegment.

private boolean pruneSegment(BrokerRequest brokerRequest) {
    // Check if segment belongs to the table being queried.
    if (!_tableName.equals(brokerRequest.getQuerySource().getTableName())) {
        LOGGER.debug("Skipping segment {} from different table {}", _segmentName, _tableName);
        return true;
    }
    // Check if any column in the query does not exist in the segment.
    Set<String> allColumns = _metadata.getAllColumns();
    if (brokerRequest.isSetAggregationsInfo()) {
        for (AggregationInfo aggregationInfo : brokerRequest.getAggregationsInfo()) {
            Map<String, String> aggregationParams = aggregationInfo.getAggregationParams();
            for (String column : aggregationParams.values()) {
                if (column != null && !column.isEmpty() && !column.equals("*") && !allColumns.contains(column)) {
                    LOGGER.debug("Skipping segment '{}', as it does not have column '{}'", _metadata.getName(), column);
                    return true;
                }
            }
            GroupBy groupBy = brokerRequest.getGroupBy();
            if (groupBy != null) {
                for (String column : groupBy.getColumns()) {
                    if (!allColumns.contains(column)) {
                        LOGGER.debug("Skipping segment '{}', as it does not have column '{}'", _metadata.getName(), column);
                        return true;
                    }
                }
            }
        }
    } else {
        if (brokerRequest.isSetSelections()) {
            for (String column : brokerRequest.getSelections().getSelectionColumns()) {
                if (!allColumns.contains(column)) {
                    LOGGER.debug("Skipping segment '{}', as it does not have column '{}'", _metadata.getName(), column);
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : GroupBy(com.linkedin.pinot.common.request.GroupBy) AggregationInfo(com.linkedin.pinot.common.request.AggregationInfo)

Example 27 with AggregationInfo

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

the class BrokerReduceServiceTest method getCountQuery.

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

Example 28 with AggregationInfo

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

the class BrokerReduceServiceTest method getAvgQuery.

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

Example 29 with AggregationInfo

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

the class BrokerReduceServiceTest method getAvgAggregationInfo.

private AggregationInfo getAvgAggregationInfo() {
    String type = "avg";
    Map<String, String> params = new HashMap<String, String>();
    params.put("column", "met");
    AggregationInfo aggregationInfo = new AggregationInfo();
    aggregationInfo.setAggregationType(type);
    aggregationInfo.setAggregationParams(params);
    return aggregationInfo;
}
Also used : HashMap(java.util.HashMap) AggregationInfo(com.linkedin.pinot.common.request.AggregationInfo)

Example 30 with AggregationInfo

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

the class BrokerReduceServiceTest method getMaxQuery.

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

Aggregations

AggregationInfo (com.linkedin.pinot.common.request.AggregationInfo)51 BrokerRequest (com.linkedin.pinot.common.request.BrokerRequest)22 ArrayList (java.util.ArrayList)21 HashMap (java.util.HashMap)21 FilterQuery (com.linkedin.pinot.common.request.FilterQuery)9 GroupBy (com.linkedin.pinot.common.request.GroupBy)6 AggregationFunctionContext (com.linkedin.pinot.core.query.aggregation.AggregationFunctionContext)5 AggregationFunctionInitializer (com.linkedin.pinot.core.plan.AggregationFunctionInitializer)3 Selection (com.linkedin.pinot.common.request.Selection)2 Operator (com.linkedin.pinot.core.common.Operator)2 BReusableFilteredDocIdSetOperator (com.linkedin.pinot.core.operator.BReusableFilteredDocIdSetOperator)2 BaseOperator (com.linkedin.pinot.core.operator.BaseOperator)2 MProjectionOperator (com.linkedin.pinot.core.operator.MProjectionOperator)2 IntermediateResultsBlock (com.linkedin.pinot.core.operator.blocks.IntermediateResultsBlock)2 MatchEntireSegmentOperator (com.linkedin.pinot.core.operator.filter.MatchEntireSegmentOperator)2 TransformExpressionOperator (com.linkedin.pinot.core.operator.transform.TransformExpressionOperator)2 Pql2Compiler (com.linkedin.pinot.pql.parsers.Pql2Compiler)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 Test (org.testng.annotations.Test)2