yashmayya commented on code in PR #14342:
URL: https://github.com/apache/pinot/pull/14342#discussion_r1824330008


##########
pinot-core/src/main/java/org/apache/pinot/core/plan/AggregationPlanNode.java:
##########
@@ -118,6 +120,34 @@ public Operator<AggregationResultsBlock> 
buildNonFilteredAggOperator() {
     return new AggregationOperator(_queryContext, aggregationInfo, 
numTotalDocs);
   }
 
+  /**
+   * Returns {@code true} if any of the aggregation functions have null 
values, {@code false} otherwise.
+   *
+   * The current implementation is pessimistic and returns {@code true} if any 
of the arguments to the aggregation
+   * functions is of function type. This is because we do not have a way to 
determine if the function will return null
+   * values without actually evaluating it.
+   */
+  private boolean hasNullValues(AggregationFunction[] aggregationFunctions) {
+    for (AggregationFunction aggregationFunction : aggregationFunctions) {
+      ExpressionContext argument = (ExpressionContext) 
aggregationFunction.getInputExpressions().get(0);
+      switch (argument.getType()) {
+        case IDENTIFIER:
+          DataSource dataSource = 
_indexSegment.getDataSource(argument.getIdentifier());
+          NullValueVectorReader nullValueVector = 
dataSource.getNullValueVector();
+          if (nullValueVector != null && 
!nullValueVector.getNullBitmap().isEmpty()) {
+            return true;
+          }
+          break;
+        case LITERAL:
+          return false;

Review Comment:
   Yeah, that makes sense 👍 



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