You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by xi...@apache.org on 2020/10/08 23:24:21 UTC

[incubator-pinot] branch make_transform_functions_support_underscore_in_it created (now 937189c)

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

xiangfu pushed a change to branch make_transform_functions_support_underscore_in_it
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git.


      at 937189c  Make transform functions support underscore in the query functions

This branch includes the following new commits:

     new 937189c  Make transform functions support underscore in the query functions

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[incubator-pinot] 01/01: Make transform functions support underscore in the query functions

Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 937189c823ab05486fa119c108d1962364d09052
Author: Xiang Fu <fx...@gmail.com>
AuthorDate: Thu Oct 8 16:23:50 2020 -0700

    Make transform functions support underscore in the query functions
---
 .../operator/transform/function/TransformFunctionFactory.java    | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/TransformFunctionFactory.java b/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/TransformFunctionFactory.java
index 6bdc701..287ba08 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/TransformFunctionFactory.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/TransformFunctionFactory.java
@@ -23,6 +23,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.pinot.common.function.FunctionInfo;
 import org.apache.pinot.common.function.FunctionRegistry;
 import org.apache.pinot.common.function.TransformFunctionType;
@@ -148,7 +149,7 @@ public class TransformFunctionFactory {
             "Caught exception while instantiating transform function from class: " + transformFunctionClass.toString(),
             e);
       }
-      String transformFunctionName = transformFunction.getName().toLowerCase();
+      String transformFunctionName = canonicalize(transformFunction.getName());
       if (TRANSFORM_FUNCTION_MAP.containsKey(transformFunctionName)) {
         throw new IllegalArgumentException("Transform function: " + transformFunctionName + " already exists");
       }
@@ -167,7 +168,7 @@ public class TransformFunctionFactory {
     switch (expression.getType()) {
       case FUNCTION:
         FunctionContext function = expression.getFunction();
-        String functionName = function.getFunctionName();
+        String functionName = canonicalize(function.getFunctionName());
         List<ExpressionContext> arguments = function.getArguments();
         int numArguments = arguments.size();
 
@@ -210,4 +211,8 @@ public class TransformFunctionFactory {
         throw new IllegalStateException();
     }
   }
+
+  private static String canonicalize(String functionName) {
+    return StringUtils.remove(functionName, '_').toLowerCase();
+  }
 }


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