dario-liberman commented on code in PR #11092:
URL: https://github.com/apache/pinot/pull/11092#discussion_r1272648479


##########
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/FunnelCountAggregationFunction.java:
##########
@@ -198,27 +278,58 @@ private int[][] getSteps(Map<ExpressionContext, 
BlockValSet> blockValSetMap) {
   }
 
   private boolean isSorted(Map<ExpressionContext, BlockValSet> blockValSetMap) 
{
-    final Dictionary primaryCorrelationDictionary = 
blockValSetMap.get(_primaryCorrelationCol).getDictionary();
-    if (primaryCorrelationDictionary == null) {
-      throw new IllegalArgumentException(
-          "CORRELATE_BY column in FUNNELCOUNT aggregation function not 
supported, please use a dictionary encoded "
-              + "column.");
+    return getDictionary(blockValSetMap).isSorted();
+  }
+
+  private AggregationStrategy getAggregationStrategy(Map<ExpressionContext, 
BlockValSet> blockValSetMap) {
+    if (_partitionSetting && _sortingSetting && isSorted(blockValSetMap)) {
+      return _sortedAggregationStrategy;
+    }
+    if (_thetaSketchSetting) {
+      return _thetaSketchAggregationStrategy;
     }
-    return primaryCorrelationDictionary.isSorted();
+    // default
+    return _bitmapAggregationStrategy;
   }
 
-  private SegmentAggregationStrategy<?, List<Long>> 
getAggregationStrategyByBlockValSetMap(
-      Map<ExpressionContext, BlockValSet> blockValSetMap) {
-    return isSorted(blockValSetMap) ? _sortedAggregationStrategy : 
_bitmapAggregationStrategy;
+  private ResultExtractionStrategy getResultExtractionStrategy(Object 
aggResult) {
+    if (_partitionSetting) {
+        if (_sortingSetting && aggResult instanceof SortedAggregationResult) {
+          return _sortedPartitionedResultExtractionStrategy;
+        }
+        if (_thetaSketchSetting) {
+          return _thetaSketchPartitionedResultExtractionStrategy;
+        }
+        return _bitmapPartitionedResultExtractionStrategy;
+    }
+    if (_thetaSketchSetting) {
+      return _thetaSketchResultExtractionStrategy;
+    }
+    if (_setSetting) {
+      return _setResultExtractionStrategy;
+    }
+    // default
+    return _bitmapResultExtractionStrategy;
   }
 
-  private SegmentAggregationStrategy<?, List<Long>> 
getAggregationStrategyByAggregationResult(Object aggResult) {
-    return aggResult instanceof SortedAggregationResult ? 
_sortedAggregationStrategy : _bitmapAggregationStrategy;
+  private MergeStrategy getMergeStrategy() {
+    if (_partitionSetting) {
+      return _partitionedMergeStrategy;
+    }
+    if (_thetaSketchSetting) {
+      return _thetaSketchMergeStrategy;
+    }
+    if (_setSetting) {
+      return _setMergeStrategy;
+    }
+    // default
+    return _bitmapMergeStrategy;
   }

Review Comment:
   The main challenge is that the strategy is somewhat dynamic, the first two 
strategies depend on whether the segment is actually sorted or not. For example 
the current open segment will not be sorted, only closed segments will.
   



-- 
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

Reply via email to