You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ja...@apache.org on 2020/09/04 19:01:04 UTC
[incubator-pinot] branch master updated: Improve test coverage for
TransformFunctionType (#5979)
This is an automated email from the ASF dual-hosted git repository.
jackie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 8900ebb Improve test coverage for TransformFunctionType (#5979)
8900ebb is described below
commit 8900ebb992f2872d379770f7196e245a6ffa37be
Author: Braden Groom <br...@gmail.com>
AuthorDate: Fri Sep 4 12:00:47 2020 -0700
Improve test coverage for TransformFunctionType (#5979)
---
.../pinot/common/function/TransformFunctionType.java | 2 +-
.../pinot/common/function/TransformFunctionTypeTest.java | 15 +++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
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 0893916..76f6446 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
@@ -93,7 +93,7 @@ public enum TransformFunctionType {
String upperCaseFunctionName = functionName.toUpperCase();
try {
return TransformFunctionType.valueOf(upperCaseFunctionName);
- } catch (Exception e) {
+ } catch (IllegalArgumentException e) {
if (FunctionRegistry.containsFunction(functionName)) {
return SCALAR;
}
diff --git a/pinot-common/src/test/java/org/apache/pinot/common/function/TransformFunctionTypeTest.java b/pinot-common/src/test/java/org/apache/pinot/common/function/TransformFunctionTypeTest.java
index 64fe7e3..fef0f38 100644
--- a/pinot-common/src/test/java/org/apache/pinot/common/function/TransformFunctionTypeTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/common/function/TransformFunctionTypeTest.java
@@ -26,7 +26,22 @@ import static org.testng.Assert.assertEquals;
public class TransformFunctionTypeTest {
@Test
+ public void testSimpleLookupFunction() {
+ assertEquals(TransformFunctionType.getTransformFunctionType("add"), TransformFunctionType.ADD);
+ }
+
+ @Test
public void testScalarFunction() {
assertEquals(TransformFunctionType.getTransformFunctionType("toEpochSeconds"), TransformFunctionType.SCALAR);
}
+
+ @Test
+ public void testSnakeCaseLookupFunction() {
+ assertEquals(TransformFunctionType.getTransformFunctionType("json_extract_scalar"), TransformFunctionType.JSONEXTRACTSCALAR);
+ }
+
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void invalidLookup() {
+ TransformFunctionType.getTransformFunctionType("foo_bar");
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org