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


##########
pinot-core/src/main/java/org/apache/pinot/core/operator/blocks/IntermediateResultsBlock.java:
##########
@@ -439,6 +450,12 @@ private DataTable attachMetadataToDataTable(DataTable 
dataTable) {
         dataTable.addException(exception);
       }
     }
+
+    if (_startreeUsed) {

Review Comment:
   I think it’s ok just to put 0 if no startrees were used



##########
pinot-core/src/main/java/org/apache/pinot/core/operator/ExecutionStatistics.java:
##########
@@ -47,6 +47,19 @@ public ExecutionStatistics(long numDocsScanned, long 
numEntriesScannedInFilter,
     _numTotalDocs = numTotalDocs;
   }
 
+  private long _numStartreeUsed = 0;
+  private boolean _startreeUsed = false;
+
+  public ExecutionStatistics(long numDocsScanned, long 
numEntriesScannedInFilter, long numEntriesScannedPostFilter,

Review Comment:
   I don’t think you need a count here, just a flag.



##########
pinot-core/src/main/java/org/apache/pinot/core/operator/combine/CombineOperatorUtils.java:
##########
@@ -54,21 +54,32 @@ public static int getNumTasksForQuery(int numOperators, int 
maxExecutionThreads)
    */
   public static void setExecutionStatistics(IntermediateResultsBlock 
resultsBlock, List<Operator> operators,
       long threadCpuTimeNs, int numServerThreads) {
+
     int numSegmentsProcessed = operators.size();
     int numSegmentsMatched = 0;
     long numDocsScanned = 0;
     long numEntriesScannedInFilter = 0;
     long numEntriesScannedPostFilter = 0;
     long numTotalDocs = 0;
+    long numStartreeUsed = 0;
+    boolean startreeUsed = false;
+
+    ExecutionStatistics executionStatistics;
     for (Operator operator : operators) {
-      ExecutionStatistics executionStatistics = 
operator.getExecutionStatistics();

Review Comment:
   It would be better not to change this, the JIT compiler may scalarise 
(replace the object with its fields) the ExecutionStatistics so long as the 
object doesn’t escape a single iteration of the loop.



##########
pinot-core/src/main/java/org/apache/pinot/core/operator/query/AggregationGroupByOrderByOperator.java:
##########
@@ -147,8 +149,13 @@ public List<Operator> getChildOperators() {
   public ExecutionStatistics getExecutionStatistics() {
     long numEntriesScannedInFilter = 
_transformOperator.getExecutionStatistics().getNumEntriesScannedInFilter();
     long numEntriesScannedPostFilter = (long) _numDocsScanned * 
_transformOperator.getNumColumnsProjected();
-    return new ExecutionStatistics(_numDocsScanned, numEntriesScannedInFilter, 
numEntriesScannedPostFilter,
-        _numTotalDocs);
+    if (_useStarTree) {

Review Comment:
   The flag could just be passed into the ExecutionStatistics here



##########
pinot-core/src/main/java/org/apache/pinot/core/operator/combine/CombineOperatorUtils.java:
##########
@@ -54,21 +54,32 @@ public static int getNumTasksForQuery(int numOperators, int 
maxExecutionThreads)
    */
   public static void setExecutionStatistics(IntermediateResultsBlock 
resultsBlock, List<Operator> operators,
       long threadCpuTimeNs, int numServerThreads) {
+
     int numSegmentsProcessed = operators.size();
     int numSegmentsMatched = 0;
     long numDocsScanned = 0;
     long numEntriesScannedInFilter = 0;
     long numEntriesScannedPostFilter = 0;
     long numTotalDocs = 0;
+    long numStartreeUsed = 0;
+    boolean startreeUsed = false;
+
+    ExecutionStatistics executionStatistics;
     for (Operator operator : operators) {
-      ExecutionStatistics executionStatistics = 
operator.getExecutionStatistics();
+      executionStatistics = operator.getExecutionStatistics();
       if (executionStatistics.getNumDocsScanned() > 0) {
         numSegmentsMatched++;
       }
       numDocsScanned += executionStatistics.getNumDocsScanned();
       numEntriesScannedInFilter += 
executionStatistics.getNumEntriesScannedInFilter();
       numEntriesScannedPostFilter += 
executionStatistics.getNumEntriesScannedPostFilter();
       numTotalDocs += executionStatistics.getNumTotalDocs();
+      if (executionStatistics.isStartreeUsed()) {

Review Comment:
   I think it’s ok just to accumulate a count in the loop above, if that count 
is zero then so be it



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