You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "xiangfu0 (via GitHub)" <gi...@apache.org> on 2023/07/04 22:12:31 UTC

[GitHub] [pinot] xiangfu0 commented on a diff in pull request #10846: [multistage] Initial planner changes to support the v1 aggregation functions in multistage

xiangfu0 commented on code in PR #10846:
URL: https://github.com/apache/pinot/pull/10846#discussion_r1242671755


##########
pinot-core/src/main/java/org/apache/pinot/core/query/reduce/function/InternalReduceFunctions.java:
##########
@@ -35,17 +35,61 @@ private InternalReduceFunctions() {
   }
 
   @ScalarFunction
-  public static double skewnessReduce(PinotFourthMoment fourthMoment) {
+  public static Double skewnessReduce(PinotFourthMoment fourthMoment) {
+    if (fourthMoment == null) {
+      return null;
+    }
     return fourthMoment.skew();
   }
 
   @ScalarFunction
-  public static double kurtosisReduce(PinotFourthMoment fourthMoment) {
+  public static Double kurtosisReduce(PinotFourthMoment fourthMoment) {
+    if (fourthMoment == null) {
+      return null;
+    }
     return fourthMoment.kurtosis();
   }
 
   @ScalarFunction
-  public static int countDistinctReduce(Set<?> values) {
+  public static Integer countDistinctReduce(Set<?> values) {
     return values.size();
   }
+
+  @ScalarFunction
+  public static Double maxReduce(Double intermediateResult) {
+    return intermediateResult;

Review Comment:
   You can just have a `SingleValueReduce` to avoid the code duplication?



##########
pinot-core/src/main/java/org/apache/pinot/core/query/aggregation/function/AggregationFunctionFactory.java:
##########
@@ -189,8 +188,7 @@ public static AggregationFunction getAggregationFunction(FunctionContext functio
           case MAX:
             return new MaxAggregationFunction(firstArgument, nullHandlingEnabled);
           case SUM:
-          // TODO(Sonam): Uncomment SUM0 when merging planner changes
-          // case SUM0:
+          case SUM0:

Review Comment:
   Is there any other functions need to append 0 after the function name?



-- 
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-unsubscribe@pinot.apache.org

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