18
18
import org .testng .annotations .Test ;
19
19
20
20
import static com .facebook .presto .common .type .DoubleType .DOUBLE ;
21
+ import static com .facebook .presto .common .type .IntegerType .INTEGER ;
21
22
import static com .facebook .presto .common .type .RealType .REAL ;
22
23
import static com .facebook .presto .spi .StandardErrorCode .FUNCTION_IMPLEMENTATION_MISSING ;
23
24
import static com .facebook .presto .spi .StandardErrorCode .INVALID_FUNCTION_ARGUMENT ;
@@ -66,6 +67,7 @@ public void testNulls()
66
67
assertFunction ("array_normalize(ARRAY[4.0E0, 3.0E0], null)" , new ArrayType (DOUBLE ), null );
67
68
assertFunction ("array_normalize(ARRAY[4.0E0, null], 2.0E0)" , new ArrayType (DOUBLE ), null );
68
69
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 );
69
71
}
70
72
71
73
@ Test
@@ -81,6 +83,10 @@ public void testArrayOfZeros()
81
83
@ Test
82
84
public void testUnsupportedType ()
83
85
{
86
+ assertInvalidFunction (
87
+ "array_normalize(ARRAY[NULL], 1)" ,
88
+ FUNCTION_IMPLEMENTATION_MISSING ,
89
+ "Unsupported array element type for array_normalize function: integer" );
84
90
assertInvalidFunction (
85
91
"array_normalize(ARRAY[1, 2, 3], 1)" ,
86
92
FUNCTION_IMPLEMENTATION_MISSING ,
0 commit comments