diff --git a/velox/functions/prestosql/registration/ArrayFunctionsRegistration.cpp b/velox/functions/prestosql/registration/ArrayFunctionsRegistration.cpp index 506e047ba8b1..f3183f4d1577 100644 --- a/velox/functions/prestosql/registration/ArrayFunctionsRegistration.cpp +++ b/velox/functions/prestosql/registration/ArrayFunctionsRegistration.cpp @@ -308,6 +308,11 @@ void registerArrayFunctions(const std::string& prefix) { registerArrayFrequencyFunctions(prefix); registerArrayFrequencyFunctions(prefix); + registerArrayNormalizeFunctions(prefix); + registerArrayNormalizeFunctions(prefix); + registerArrayNormalizeFunctions(prefix); + registerArrayNormalizeFunctions(prefix); + registerArrayNormalizeFunctions(prefix); registerArrayNormalizeFunctions(prefix); registerArrayNormalizeFunctions(prefix); } diff --git a/velox/functions/prestosql/tests/ArrayNormalizeTest.cpp b/velox/functions/prestosql/tests/ArrayNormalizeTest.cpp index 5f40f84010f3..5493df0cc1eb 100644 --- a/velox/functions/prestosql/tests/ArrayNormalizeTest.cpp +++ b/velox/functions/prestosql/tests/ArrayNormalizeTest.cpp @@ -55,15 +55,17 @@ class ArrayNormalizeTest : public FunctionBaseTest { template void testArrayWithElementsEqualZero() { - auto input = makeArrayVector({{0.0, -0.0, 0.0}}); - auto p = makeConstant(2.0, input->size()); + auto input = makeArrayVector( + {{static_cast(0.0), static_cast(-0.0), static_cast(0.0)}}); + auto p = makeConstant(static_cast(2.0), input->size()); testExpr(input, {input, p}); } template void testArrayWithPLessThanZero() { - auto input = makeArrayVector({{1.0, 2.0, 3.0}}); - auto p = makeConstant(-1.0, input->size()); + auto input = makeArrayVector( + {{static_cast(1.0), static_cast(2.0), static_cast(3.0)}}); + auto p = makeConstant(static_cast(-1.0), input->size()); VELOX_ASSERT_THROW( testExpr(input, {input, p}), "array_normalize only supports non-negative p"); @@ -71,8 +73,9 @@ class ArrayNormalizeTest : public FunctionBaseTest { template void testArrayWithPEqualZero() { - auto vector = makeArrayVector({{1.0, -2.0, 3.0}}); - auto p = makeConstant(0.0, vector->size()); + auto vector = makeArrayVector( + {{static_cast(1.0), static_cast(-2.0), static_cast(3.0)}}); + auto p = makeConstant(static_cast(0.0), vector->size()); testExpr(vector, {vector, p}); } @@ -159,16 +162,19 @@ class ArrayNormalizeTest : public FunctionBaseTest { }; TEST_F(ArrayNormalizeTest, arrayWithElementsZero) { + testArrayWithElementsEqualZero(); testArrayWithElementsEqualZero(); testArrayWithElementsEqualZero(); } TEST_F(ArrayNormalizeTest, pLessThanZero) { + testArrayWithElementsEqualZero(); testArrayWithPLessThanZero(); testArrayWithPLessThanZero(); } TEST_F(ArrayNormalizeTest, pEqualsZero) { + testArrayWithPEqualZero(); testArrayWithPEqualZero(); testArrayWithPEqualZero(); } @@ -179,21 +185,25 @@ TEST_F(ArrayNormalizeTest, pLessThanOne) { } TEST_F(ArrayNormalizeTest, pEqualsOne) { + testArrayWithPEqualOne(); testArrayWithPEqualOne(); testArrayWithPEqualOne(); } TEST_F(ArrayNormalizeTest, limits) { + testArrayWithPEqualOne(); testArrayWithTypeLimits(); testArrayWithTypeLimits(); } TEST_F(ArrayNormalizeTest, nullValues) { + testArrayWithPEqualOne(); testArrayWithNullValues(); testArrayWithNullValues(); } TEST_F(ArrayNormalizeTest, differentValues) { + testArrayWithPEqualOne(); testArrayWithDifferentValues(); testArrayWithDifferentValues(); }