wuwenw commented on a change in pull request #6991:
URL: https://github.com/apache/incubator-pinot/pull/6991#discussion_r641166342



##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/groupby/DefaultGroupByExecutor.java
##########
@@ -144,4 +147,22 @@ protected void aggregate(TransformBlock transformBlock, 
int length, int function
   public AggregationGroupByResult getResult() {
     return new AggregationGroupByResult(_groupKeyGenerator, 
_aggregationFunctions, _groupByResultHolders);
   }
+
+  @Override
+  public Collection<TableResizer.fullIntermediateResult> trimGroupByResult(int 
threshold, TableResizer tableResizer) {
+    // Check if a trim is necessary
+    int keyNum = 0;
+    if (_hasMVGroupByExpression) {
+      keyNum = _mvGroupKeys.length;
+    } else {
+      keyNum = _svGroupKeys.length;
+    }
+    Iterator<GroupKeyGenerator.GroupKey> groupKeyIterator = 
_groupKeyGenerator.getGroupKeys();
+    if (keyNum > threshold && threshold != -1) {
+      return tableResizer.trimInSegmentResults(groupKeyIterator, 
_groupByResultHolders, threshold);

Review comment:
       Now the threshold is calculated in the instance plan maker
   
   > threshold should be calculated based on the `limit` instead of hardcoded
   
   




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

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