siddharthteotia commented on a change in pull request #5440:
URL: https://github.com/apache/incubator-pinot/pull/5440#discussion_r430077444
##########
File path:
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/TransformFunctionFactory.java
##########
@@ -112,13 +115,24 @@ public static TransformFunction
get(TransformExpressionTree expression, Map<Stri
switch (expression.getExpressionType()) {
case FUNCTION:
String functionName = expression.getValue();
- Class<? extends TransformFunction> transformFunctionClass =
TRANSFORM_FUNCTION_MAP.get(functionName);
+ Class<? extends TransformFunction> transformFunctionClass;
+ FunctionInfo functionInfo = null;
+ if (FunctionRegistry.containsFunctionByName(functionName)) {
+ transformFunctionClass = GenericTransformFunction.class;
+ functionInfo = FunctionRegistry.getFunctionByName(functionName);
Review comment:
I am not sure I follow the logic here. Is GenericTransformFunction going
to be the wrapper or single point of entry for all transform functions in
Pinot. The name seems to suggest so but this code implies that only the
functions registered in the registry can be treated as
GenericTransformFunction.
This also brings the point that we should add good javadocs to the new
class.
##########
File path:
pinot-core/src/test/java/org/apache/pinot/core/operator/transform/function/GenericTransformFunctionTest.java
##########
@@ -0,0 +1,173 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.core.operator.transform.function;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.pinot.common.request.transform.TransformExpressionTree;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+
+public class GenericTransformFunctionTest extends BaseTransformFunctionTest {
+
+ @Test
Review comment:
I believe this exercises the compilation path. You should add tests in
CalciteSqlCompiler test file as well.
Also, we should add tests for end to end query execution. See
TransformQueriesTest class or consider adding these to one of the existing
query tests
##########
File path:
pinot-core/src/test/java/org/apache/pinot/core/operator/transform/function/GenericTransformFunctionTest.java
##########
@@ -0,0 +1,173 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.core.operator.transform.function;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.pinot.common.request.transform.TransformExpressionTree;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+
+public class GenericTransformFunctionTest extends BaseTransformFunctionTest {
+
+ @Test
Review comment:
I believe this exercises the compilation path. You should add tests in
CalciteSqlCompiler test file as well.
Also, we should add tests for end to end query execution. See
TransformQueriesTest class or consider adding execution tests to one of the
existing query tests
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]