This is an automated email from the ASF dual-hosted git repository.

xiangfu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 7a3d89cb19 Add array functions to v2 fn registry (#11455)
7a3d89cb19 is described below

commit 7a3d89cb194977fde429ae34f2a121d27e5f89ec
Author: Saurabh Dubey <saurabhd...@gmail.com>
AuthorDate: Wed Aug 30 11:23:28 2023 +0530

    Add array functions to v2 fn registry (#11455)
    
    * Add array functions to v2 fn registry
    
    * Change sum data type
    
    * Log10
    
    * Remove log10 fix
    
    ---------
    
    Co-authored-by: Saurabh Dubey <saurabh.dubey@Saurabhs-MacBook-Pro.local>
---
 .../pinot/common/function/FunctionRegistry.java    | 25 ++++++++++++++++++++++
 .../common/function/TransformFunctionType.java     | 10 +++++----
 2 files changed, 31 insertions(+), 4 deletions(-)

diff --git 
a/pinot-common/src/main/java/org/apache/pinot/common/function/FunctionRegistry.java
 
b/pinot-common/src/main/java/org/apache/pinot/common/function/FunctionRegistry.java
index e4c3b251de..023d21ff0d 100644
--- 
a/pinot-common/src/main/java/org/apache/pinot/common/function/FunctionRegistry.java
+++ 
b/pinot-common/src/main/java/org/apache/pinot/common/function/FunctionRegistry.java
@@ -217,5 +217,30 @@ public class FunctionRegistry {
     public static String arrayToMV(Object multiValue) {
       throw new UnsupportedOperationException("Placeholder scalar function, 
should not reach here");
     }
+
+    @ScalarFunction(names = "arrayMin", isPlaceholder = true)
+    public static String arrayMin(Object multiValue) {
+      throw new UnsupportedOperationException("Placeholder scalar function, 
should not reach here");
+    }
+
+    @ScalarFunction(names = "arrayMax", isPlaceholder = true)
+    public static String arrayMax(Object multiValue) {
+      throw new UnsupportedOperationException("Placeholder scalar function, 
should not reach here");
+    }
+
+    @ScalarFunction(names = "arrayLength", isPlaceholder = true)
+    public static String arrayLength(Object multiValue) {
+      throw new UnsupportedOperationException("Placeholder scalar function, 
should not reach here");
+    }
+
+    @ScalarFunction(names = "arrayAverage", isPlaceholder = true)
+    public static String arrayAverage(Object multiValue) {
+      throw new UnsupportedOperationException("Placeholder scalar function, 
should not reach here");
+    }
+
+    @ScalarFunction(names = "arraySum", isPlaceholder = true)
+    public static String arraySum(Object multiValue) {
+      throw new UnsupportedOperationException("Placeholder scalar function, 
should not reach here");
+    }
   }
 }
diff --git 
a/pinot-common/src/main/java/org/apache/pinot/common/function/TransformFunctionType.java
 
b/pinot-common/src/main/java/org/apache/pinot/common/function/TransformFunctionType.java
index b27c6cd53b..a02a8c8277 100644
--- 
a/pinot-common/src/main/java/org/apache/pinot/common/function/TransformFunctionType.java
+++ 
b/pinot-common/src/main/java/org/apache/pinot/common/function/TransformFunctionType.java
@@ -163,10 +163,12 @@ public enum TransformFunctionType {
   // The only column accepted by "cardinality" function is multi-value array, 
thus putting "cardinality" as alias.
   // TODO: once we support other types of multiset, we should make CARDINALITY 
its own function
   ARRAYLENGTH("arrayLength", "cardinality"),
-  ARRAYAVERAGE("arrayAverage"),
-  ARRAYMIN("arrayMin"),
-  ARRAYMAX("arrayMax"),
-  ARRAYSUM("arraySum"),
+  ARRAYAVERAGE("arrayAverage", ReturnTypes.DOUBLE, 
OperandTypes.family(SqlTypeFamily.ARRAY)),
+  ARRAYMIN("arrayMin", ReturnTypes.cascade(opBinding -> 
positionalComponentReturnType(opBinding, 0),
+      SqlTypeTransforms.FORCE_NULLABLE), 
OperandTypes.family(SqlTypeFamily.ARRAY)),
+  ARRAYMAX("arrayMax", ReturnTypes.cascade(opBinding -> 
positionalComponentReturnType(opBinding, 0),
+      SqlTypeTransforms.FORCE_NULLABLE), 
OperandTypes.family(SqlTypeFamily.ARRAY)),
+  ARRAYSUM("arraySum", ReturnTypes.DOUBLE, 
OperandTypes.family(SqlTypeFamily.ARRAY)),
   VALUEIN("valueIn"),
   MAPVALUE("mapValue", ReturnTypes.cascade(opBinding ->
       opBinding.getOperandType(2).getComponentType(), 
SqlTypeTransforms.FORCE_NULLABLE),


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

Reply via email to