From 55fe7bc25c327a5be76e38ee18332a75c0282ff8 Mon Sep 17 00:00:00 2001 From: Peter Enescu Date: Wed, 29 Jan 2025 11:37:06 -0800 Subject: [PATCH] revert: Revert array_has_duplicates unit test due to Linux/Ubuntu test mismatch Summary: New unit test for array_has_duplicates fails on Linux but not Ubuntu. Undoing the addition temporarily while we investigate the issue in case it's a result of added Json functionality Differential Revision: D68845988 --- .../ArrayFunctionsRegistration.cpp | 1 - .../tests/ArrayHasDuplicatesTest.cpp | 40 ------------------- 2 files changed, 41 deletions(-) diff --git a/velox/functions/prestosql/registration/ArrayFunctionsRegistration.cpp b/velox/functions/prestosql/registration/ArrayFunctionsRegistration.cpp index a91df48cf1bb1..2995cc0196c0c 100644 --- a/velox/functions/prestosql/registration/ArrayFunctionsRegistration.cpp +++ b/velox/functions/prestosql/registration/ArrayFunctionsRegistration.cpp @@ -317,7 +317,6 @@ void registerArrayFunctions(const std::string& prefix) { registerArrayHasDuplicatesFunctions(prefix); registerArrayHasDuplicatesFunctions(prefix); registerArrayHasDuplicatesFunctions(prefix); - registerArrayHasDuplicatesFunctions(prefix); registerArrayFrequencyFunctions(prefix); registerArrayFrequencyFunctions(prefix); diff --git a/velox/functions/prestosql/tests/ArrayHasDuplicatesTest.cpp b/velox/functions/prestosql/tests/ArrayHasDuplicatesTest.cpp index fc9bbd7426575..4cc8199c92d3f 100644 --- a/velox/functions/prestosql/tests/ArrayHasDuplicatesTest.cpp +++ b/velox/functions/prestosql/tests/ArrayHasDuplicatesTest.cpp @@ -16,7 +16,6 @@ #include #include "velox/functions/prestosql/tests/utils/FunctionBaseTest.h" -#include "velox/functions/prestosql/types/JsonType.h" using namespace facebook::velox; using namespace facebook::velox::test; @@ -146,42 +145,3 @@ TEST_F(ArrayHasDuplicatesTest, nullFreeStrings) { auto expected = makeFlatVector({false, true, false, true}); testExpr(expected, "array_has_duplicates(C0)", {array}); } - -TEST_F(ArrayHasDuplicatesTest, json) { - auto result = evaluate( - "array_has_duplicates(C0)", - makeRowVector({makeNullableArrayVector( - {{R"({"key":"value"})", R"({"key":"value"})"}}, ARRAY(JSON()))})); - assertEqualVectors(makeFlatVector(true), result); - - result = evaluate( - "array_has_duplicates(C0)", - makeRowVector({makeNullableArrayVector( - {{R"({"key":"value"})"}, - {R"({"key":"same_value"})", - R"({"key":"another_value"})", - R"({"key":"same_value"})"}, - {std::nullopt, std::nullopt}, - {R"({"key":"value"})", R"({"key":"another_value"})"}, - {R"({"key":"value"})", - R"({"key":"another_value"})", - R"({"another_key":"value"})"}, - {R"({"key": "value\with\backslash"})", - R"({"key": "value\with\backslash"})"}, - {R"({"key": "value\nwith\nnewline"})", - R"({"key": "value\nwith\nnewline"})"}, - {R"({"key": "value with \u00A9 and \u20AC"})", - R"({"key": "value with \u00A9 and \u20AC"})"}, - {R"({"key": "!@#$%^&*()_+-={}:<>?,./~`"})", - R"({"key": "!@#$%^&*()_+-={}:<>?,./~`"})"}, - {R"({"key":"value"})", - std::nullopt, - R"({"key":"another_value"})", - R"({"another_key":"value"})", - std::nullopt}}, - ARRAY(JSON()))})); - assertEqualVectors( - makeFlatVector(std::vector{ - {false, true, true, false, false, true, true, true, true, true}}), - result); -}