richardstartin commented on code in PR #14662:
URL: https://github.com/apache/pinot/pull/14662#discussion_r1888861830


##########
pinot-core/src/main/java/org/apache/pinot/core/data/table/IndexedTable.java:
##########
@@ -157,11 +166,44 @@ public void finish(boolean sort, boolean 
storeFinalResult) {
       for (int i = 0; i < numAggregationFunctions; i++) {
         columnDataTypes[i + _numKeyColumns] = 
_aggregationFunctions[i].getFinalResultColumnType();
       }
-      for (Record record : _topRecords) {
-        Object[] values = record.getValues();
-        for (int i = 0; i < numAggregationFunctions; i++) {
-          int colId = i + _numKeyColumns;
-          values[colId] = 
_aggregationFunctions[i].extractFinalResult(values[colId]);

Review Comment:
   > If shared thread pool is overwhelmed by running tasks it might be good to 
use current thread not only to wait but also task processing, stealing tasks 
until there's nothing left and only then waiting for futures to finish.
   
   Potentially, and this can be done transparently by configuring the 
executor's rejected execution handler to 
[CallerRunsPolicy](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ThreadPoolExecutor.CallerRunsPolicy.html).
 However, beware if the executor, which does non-blocking work, is sized to the 
number of available processors, then if the thread pool is overwhelmed, it 
means the available CPUs are overwhelmed too. Performing reductions on the 
caller thread would only lead to excessive context switching and it might be 
better, from a global perspective, for the task to wait for capacity to be 
available.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to