Skip to content

Commit 47e3730

Browse files
committed
Add more tests for ArrayNormalizeFunction.
1 parent 3d62b27 commit 47e3730

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

presto-main/src/test/java/com/facebook/presto/operator/scalar/TestArrayNormalizeFunction.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.testng.annotations.Test;
1919

2020
import static com.facebook.presto.common.type.DoubleType.DOUBLE;
21+
import static com.facebook.presto.common.type.IntegerType.INTEGER;
2122
import static com.facebook.presto.common.type.RealType.REAL;
2223
import static com.facebook.presto.spi.StandardErrorCode.FUNCTION_IMPLEMENTATION_MISSING;
2324
import static com.facebook.presto.spi.StandardErrorCode.INVALID_FUNCTION_ARGUMENT;
@@ -66,6 +67,7 @@ public void testNulls()
6667
assertFunction("array_normalize(ARRAY[4.0E0, 3.0E0], null)", new ArrayType(DOUBLE), null);
6768
assertFunction("array_normalize(ARRAY[4.0E0, null], 2.0E0)", new ArrayType(DOUBLE), null);
6869
assertFunction("array_normalize(ARRAY[REAL '4.0', REAL '3.0'], null)", new ArrayType(REAL), null);
70+
assertFunction("array_normalize(null, 4)", new ArrayType(INTEGER), null);
6971
}
7072

7173
@Test
@@ -81,6 +83,10 @@ public void testArrayOfZeros()
8183
@Test
8284
public void testUnsupportedType()
8385
{
86+
assertInvalidFunction(
87+
"array_normalize(ARRAY[NULL], 1)",
88+
FUNCTION_IMPLEMENTATION_MISSING,
89+
"Unsupported array element type for array_normalize function: integer");
8490
assertInvalidFunction(
8591
"array_normalize(ARRAY[1, 2, 3], 1)",
8692
FUNCTION_IMPLEMENTATION_MISSING,

0 commit comments

Comments
 (0)