You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/05/28 02:38:04 UTC

[GitHub] [incubator-pinot] wuwenw commented on a change in pull request #6991: Introduce in-Segment Trim for GroupBy OrderBy Query

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org