You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "walterddr (via GitHub)" <gi...@apache.org> on 2023/02/14 03:54:21 UTC

[GitHub] [pinot] walterddr commented on a diff in pull request #10266: Add name case for ScalarFunction annotation for casewhen

walterddr commented on code in PR #10266:
URL: https://github.com/apache/pinot/pull/10266#discussion_r1105260848


##########
pinot-common/src/test/java/org/apache/pinot/common/function/FunctionDefinitionRegistryTest.java:
##########
@@ -42,9 +42,9 @@ public class FunctionDefinitionRegistryTest {
   );
   private static final List<String> IGNORED_FUNCTION_NAMES = ImmutableList.of(
       // functions we are not supporting post transform anyway
-      "valuein", "mapvalue", "inidset", "lookup", "groovy", "scalar", "geotoh3", "case", "not_in", "timeconvert",
+      "valuein", "mapvalue", "inidset", "lookup", "groovy", "scalar", "geotoh3", "not_in", "timeconvert",
       // functions not needed for register b/c they are in std sql table or they will not be composed directly.
-      "in", "and", "or", "not", "range", "extract"

Review Comment:
   why is "not" also included here?



##########
pinot-common/src/main/java/org/apache/pinot/common/function/scalar/ObjectFunctions.java:
##########
@@ -94,33 +94,41 @@ private static Object coalesceVar(Object... objects) {
     return null;
   }
 
-  @ScalarFunction
-  public static Object caseWhen(boolean c1, Object o1, Object oe) {
+  @Nullable
+  @ScalarFunction(nullableParameters = true, names = {"case", "caseWhen", "case_when"})

Review Comment:
   technically `caseWhen` is not supposed to be a valid query function (e.g. should not be user-facing). It is only done this way b/c in V2 engine we manually encode the `case when ... then .. else ... end` as `caseWhen` to distinguish from the function name `case`, which is matched to the transform function instead of the scalar function



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