atris commented on a change in pull request #7916: URL: https://github.com/apache/pinot/pull/7916#discussion_r770793263
########## File path: pinot-core/src/main/java/org/apache/pinot/core/plan/AggregationPlanNode.java ########## @@ -154,4 +138,151 @@ private static boolean isFitForDictionaryBasedPlan(AggregationFunction[] aggrega } return true; } + + /** + * Build a CombinedTransformOperator given the main predicate filter operator and the corresponding + * aggregation functions. + * @param nonFilteredTransformOperator Transform operator corresponding to the main predicate + * @param mainPredicateFilterOperator Filter operator corresponding to the main predicate + * @param expressionsToTransform Expressions to transform + * @param aggregationFunctions Aggregation functions in the query + */ + private TransformOperator buildOperatorForFilteredAggregations(TransformOperator nonFilteredTransformOperator, + BaseFilterOperator mainPredicateFilterOperator, + Set<ExpressionContext> expressionsToTransform, + AggregationFunction[] aggregationFunctions) { + Map<ExpressionContext, TransformOperator> transformOperatorMap = new HashMap<>(); + Map<ExpressionContext, BaseFilterOperator> baseFilterOperatorMap = + new HashMap<>(); + List<Pair<ExpressionContext, Pair<FilterPlanNode, BaseFilterOperator>>> filterPredicatesAndMetadata = + new ArrayList<>(); + + // For each aggregation function, check if the aggregation function is a filtered agg. + // If it is, populate the corresponding filter operator and metadata + for (AggregationFunction aggregationFunction : aggregationFunctions) { + if (aggregationFunction instanceof FilterableAggregationFunction) { + FilterableAggregationFunction filterableAggregationFunction = + (FilterableAggregationFunction) aggregationFunction; + Pair<FilterPlanNode, BaseFilterOperator> pair = + buildFilterOperator(filterableAggregationFunction.getFilterContext()); + + baseFilterOperatorMap.put(filterableAggregationFunction.getAssociatedExpressionContext(), + pair.getRight()); + filterPredicatesAndMetadata.add(Pair.of(filterableAggregationFunction.getAssociatedExpressionContext(), + pair)); Review comment: I am confused. Isn't filterPredicatesAndMetadata a List already? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org