This is an automated email from the ASF dual-hosted git repository. kxiao pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push: new 627ce77c64b [cases](array-functions)align function with master #28492 #31621 (#38699) 627ce77c64b is described below commit 627ce77c64b1365340fd9f7c96ad1da8fa3f6b0b Author: amory <wangqian...@selectdb.com> AuthorDate: Sat Aug 3 06:22:26 2024 +0800 [cases](array-functions)align function with master #28492 #31621 (#38699) --- .../test_array_element_at_and_slice.out | 168 ++++ .../test_array_functions_array_intersect_sort.out | 193 ++++ .../test_array_functions_array_join.out | 52 + .../test_array_functions_array_with_const.out | 31 + ...t_array_functions_concat_compact_difference.out | 81 ++ .../test_array_functions_in_ck_case.out | 1043 ++++++++++++++++++++ .../test_array_push_pop_backfront.out | 91 ++ .../test_array_zip_array_enumerate_uniq.out | 13 + .../test_array_functions_of_array_countEqual.out | 12 + .../test_array_functions_of_array_difference.out | 6 + .../nested_types/query/array_functions/load.groovy | 22 + .../test_array_element_at_and_slice.groovy | 75 ++ ...est_array_functions_array_intersect_sort.groovy | 134 +++ .../test_array_functions_array_join.groovy | 59 ++ .../test_array_functions_array_with_const.groovy | 42 + ...rray_functions_concat_compact_difference.groovy | 72 ++ .../test_array_push_pop_backfront.groovy | 59 ++ .../test_array_zip_array_enumerate_uniq.groovy | 75 ++ ...test_array_functions_of_array_countEqual.groovy | 1 + ...test_array_functions_of_array_difference.groovy | 4 + 20 files changed, 2233 insertions(+) diff --git a/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_element_at_and_slice.out b/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_element_at_and_slice.out new file mode 100644 index 00000000000..ffc38d54cc7 --- /dev/null +++ b/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_element_at_and_slice.out @@ -0,0 +1,168 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !old_sql -- +array_element_at + +-- !old_sql -- +\N +\N +\N +\N +\N +\N +\N +\N +\N +\N +\N +\N + +-- !old_sql -- +\N +\N +\N +\N +\N +\N +\N +\N +\N +\N +\N +\N + +-- !old_sql -- +\N +true + +-- !old_sql -- +\N +\N +\N +1 +1 +1 +1 +1 +1 +1 + +-- !old_sql -- +\N +\N +0 +1 +2 +3 +4 +5 +6 +7 + +-- !old_sql -- +\N +\N +0 +1 +2 +3 +4 +5 +6 +7 + +-- !old_sql -- +\N +\N +\N +[0] +[0] +[0] +[0] +[0] +[0] +[0] + +-- !old_sql -- +\N +\N +[0, 1, 2, 3, 4, 5, 6] +[0, 1, 2, 3, 4, 5] +[0, 1, 2, 3, 4] +[0, 1, 2, 3] +[0, 1, 2] +[0, 1] +[0] +[] + +-- !old_sql -- +\N +\N +[0, 1, 2, 3, 4, 5, 6] +[0, 1, 2, 3, 4, 5] +[0, 1, 2, 3, 4] +[0, 1, 2, 3] +[0, 1, 2] +[0, 1] +[0] +[] + +-- !old_sql -- +array_slice + +-- !old_sql -- +\N + +-- !old_sql -- +\N + +-- !old_sql -- +\N + +-- !old_sql -- +\N + +-- !old_sql -- +\N + +-- !old_sql -- +[2, 3, 4] + +-- !old_sql -- +[] + +-- !old_sql -- +[3, 4] + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[2, null, 4, 5] + +-- !old_sql -- +["b", "c", "d"] + +-- !old_sql -- +["b", null, "d"] + diff --git a/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_functions_array_intersect_sort.out b/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_functions_array_intersect_sort.out new file mode 100644 index 00000000000..0127b7b25db --- /dev/null +++ b/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_functions_array_intersect_sort.out @@ -0,0 +1,193 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !oLd_sql -- +array_intersect-array-sort + +-- !old_sql -- +[1, 2] +[1, 2] +[1] +[] + +-- !old_sql -- +[] +[] +[] +[] + +-- !old_sql -- +[] +[] +[] +[] + +-- !old_sql -- +[1, 2] +[1, 2] +[1] +[] + +-- !old_sql -- +[1, 2] +[1, 2] +[1, 2] +[1, 2] + +-- !old_sql -- +[] +[] +[] +[] + +-- !old_sql -- +[1, 2] +[1, 2] +[1] +[] + +-- !old_sql -- +[] +[] +[] +[] + +-- !old_sql -- +[] +[] +[] +[] + +-- !old_sql -- +[1, 2] +[1, 2] +[1] +[] + +-- !old_sql -- +[1, 2] +[1, 2] +[1, 2] +[1, 2] + +-- !old_sql -- +[] +[] +[] +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +["a"] + +-- !old_sql -- +[] + +-- !old_sql -- +[1] + +-- !old_sql -- +[] + +-- !old_sql -- +[2] + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !nereid_sql -- +array_intersect-array-sort + +-- !nereid_sql -- +[1, 2] +[1, 2] +[1] +[] + +-- !nereid_sql -- +[] +[] +[] +[] + +-- !nereid_sql -- +[] +[] +[] +[] + +-- !nereid_sql -- +[1, 2] +[1, 2] +[1] +[] + +-- !nereid_sql -- +[1, 2] +[1, 2] +[1, 2] +[1, 2] + +-- !nereid_sql -- +[] +[] +[] +[] + +-- !nereid_sql -- +[1, 2] +[1, 2] +[1] +[] + +-- !nereid_sql -- +[] +[] +[] +[] + +-- !nereid_sql -- +[] +[] +[] +[] + +-- !nereid_sql -- +[1, 2] +[1, 2] +[1] +[] + +-- !nereid_sql -- +[1, 2] +[1, 2] +[1, 2] +[1, 2] + +-- !nereid_sql -- +[] +[] +[] +[] + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +["a"] + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +[1] + diff --git a/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_functions_array_join.out b/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_functions_array_join.out new file mode 100644 index 00000000000..81b67cb0b4d --- /dev/null +++ b/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_functions_array_join.out @@ -0,0 +1,52 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !old_sql -- +array-join + +-- !old_sql -- +Hello, World + +-- !old_sql -- +\N + +0 +01 +012 +0123 +01234 +012345 +0123456 +01234567 + +-- !old_sql -- +\N + +0 +0,1 +0,1,2 +0,1,2,3 +0,1,2,3,4 +0,1,2,3,4,5 +0,1,2,3,4,5,6 +0,1,2,3,4,5,6,7 + +-- !old_sql -- +\N + + + +0 +0 +0_1 +0_1 +0_1_2 +0_1_2 + +-- !old_sql -- +hello;world;xyz;def + +-- !old_sql -- +1;23;456 + +-- !old_sql -- +1;23;456 + diff --git a/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_functions_array_with_const.out b/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_functions_array_with_const.out new file mode 100644 index 00000000000..f7de548b61a --- /dev/null +++ b/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_functions_array_with_const.out @@ -0,0 +1,31 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !old_sql -- +array_with_constant + +-- !old_sql -- +[0, 0, 0] +[1, 1, 1] +[2, 2, 2] +[3, 3, 3] +[4, 4, 4] +[5, 5, 5] +[6, 6, 6] +[7, 7, 7] +[8, 8, 8] +[null, null, null] + +-- !old_sql -- +["Hello", "Hello", "Hello", "Hello", "Hello", "Hello", "Hello", "Hello"] +["Hello", "Hello", "Hello", "Hello", "Hello", "Hello", "Hello"] +["Hello", "Hello", "Hello", "Hello", "Hello", "Hello"] +["Hello", "Hello", "Hello", "Hello", "Hello"] +["Hello", "Hello", "Hello", "Hello"] +["Hello", "Hello", "Hello"] +["Hello", "Hello"] +["Hello"] +[] +[] + +-- !old_sql -- +["qwerty", "qwerty"] [] [1] + diff --git a/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_functions_concat_compact_difference.out b/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_functions_concat_compact_difference.out new file mode 100644 index 00000000000..bd081dc8994 --- /dev/null +++ b/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_functions_concat_compact_difference.out @@ -0,0 +1,81 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !old_sql -- +array_concat + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[null] + +-- !old_sql -- +[null, 1] + +-- !old_sql -- +[1.0, 2.0, -1.0, -2.0, 0.3, 0.7, null] + +-- !old_sql -- +\N + +-- !old_sql -- +\N + +-- !old_sql -- +[1, 2, 3, 4] + +-- !old_sql -- +[1, 2, 3, 4] + +-- !old_sql -- +[] + +-- !old_sql -- +["abc", "def", "gh", "qwe"] + +-- !old_sql -- +[1, null, 2, 3, null, 4] + +-- !old_sql -- +[1, null, 2, 3, 4] + +-- !old_sql -- +array_compact + +-- !old_sql -- +\N +["0", "1", "2", "3"] +["0", "1", "2"] +["0", "1", "2"] +["0", "1", "2"] +["0", "1"] +["0", "1"] +["0", "1"] +["0"] +["0"] +["0"] +[] + +-- !old_sql -- +array_difference + +-- !old_sql -- +[0, -9223372036854841344] + +-- !old_sql -- +[0, -9] + +-- !old_sql -- +[0, -9] + +-- !old_sql -- +[0, -9] + +-- !old_sql -- +[0, -2147483747] + diff --git a/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_functions_in_ck_case.out b/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_functions_in_ck_case.out new file mode 100644 index 00000000000..8d8c3db4a54 --- /dev/null +++ b/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_functions_in_ck_case.out @@ -0,0 +1,1043 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !sql -- +array-join + +-- !old_sql -- +Hello, World + +-- !old_sql -- +\N + +0 +01 +012 +0123 +01234 +012345 +0123456 +01234567 + +-- !old_sql -- +\N + +0 +0,1 +0,1,2 +0,1,2,3 +0,1,2,3,4 +0,1,2,3,4,5 +0,1,2,3,4,5,6 +0,1,2,3,4,5,6,7 + +-- !old_sql -- +\N + + + +0 +0 +0_1 +0_1 +0_1_2 +0_1_2 + +-- !old_sql -- +hello;world;xyz;def + +-- !old_sql -- +1;23;456 + +-- !old_sql -- +1;23;456 + +-- !sql -- +array_with_constant + +-- !old_sql -- +[0, 0, 0] +[1, 1, 1] +[2, 2, 2] +[3, 3, 3] +[4, 4, 4] +[5, 5, 5] +[6, 6, 6] +[7, 7, 7] +[8, 8, 8] +[null, null, null] + +-- !old_sql -- +["Hello", "Hello", "Hello", "Hello", "Hello", "Hello", "Hello", "Hello"] +["Hello", "Hello", "Hello", "Hello", "Hello", "Hello", "Hello"] +["Hello", "Hello", "Hello", "Hello", "Hello", "Hello"] +["Hello", "Hello", "Hello", "Hello", "Hello"] +["Hello", "Hello", "Hello", "Hello"] +["Hello", "Hello", "Hello"] +["Hello", "Hello"] +["Hello"] +[] +[] + +-- !old_sql -- +["qwerty", "qwerty"] [] [1] + +-- !sql -- +array_intersect-array-sort + +-- !old_sql -- +[1, 2] +[1, 2] +[1] +[] + +-- !old_sql -- +[] +[] +[] +[] + +-- !old_sql -- +[] +[] +[] +[] + +-- !old_sql -- +[1, 2] +[1, 2] +[1] +[] + +-- !old_sql -- +[1, 2] +[1, 2] +[1, 2] +[1, 2] + +-- !old_sql -- +[] +[] +[] +[] + +-- !old_sql -- +[1, 2] +[1, 2] +[1] +[] + +-- !old_sql -- +[] +[] +[] +[] + +-- !old_sql -- +[] +[] +[] +[] + +-- !old_sql -- +[1, 2] +[1, 2] +[1] +[] + +-- !old_sql -- +[1, 2] +[1, 2] +[1, 2] +[1, 2] + +-- !old_sql -- +[] +[] +[] +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +["a"] + +-- !old_sql -- +[] + +-- !old_sql -- +[1] + +-- !old_sql -- +[] + +-- !old_sql -- +[2] + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !sql -- +array_element_at + +-- !old_sql -- +\N +\N +\N +\N +\N +\N +\N +\N +\N +\N +\N +\N + +-- !old_sql -- +\N +\N +\N +\N +\N +\N +\N +\N +\N +\N +\N +\N + +-- !old_sql -- +\N +true + +-- !old_sql -- +\N +\N +\N +1 +1 +1 +1 +1 +1 +1 + +-- !old_sql -- +\N +\N +0 +1 +2 +3 +4 +5 +6 +7 + +-- !old_sql -- +\N +\N +0 +1 +2 +3 +4 +5 +6 +7 + +-- !old_sql -- +\N +\N +\N +[0] +[0] +[0] +[0] +[0] +[0] +[0] + +-- !old_sql -- +\N +\N +[0, 1, 2, 3, 4, 5, 6] +[0, 1, 2, 3, 4, 5] +[0, 1, 2, 3, 4] +[0, 1, 2, 3] +[0, 1, 2] +[0, 1] +[0] +[] + +-- !old_sql -- +\N +\N +[0, 1, 2, 3, 4, 5, 6] +[0, 1, 2, 3, 4, 5] +[0, 1, 2, 3, 4] +[0, 1, 2, 3] +[0, 1, 2] +[0, 1] +[0] +[] + +-- !sql -- +array_enumerate_uniq + +-- !old_sql -- +[1, 1, 2] + +-- !old_sql -- +[1, 1, 1] + +-- !old_sql -- +[1] + +-- !sql -- +array_concat_slice_push_back_push_front_pop_back_pop_front + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[null] + +-- !old_sql -- +[null, 1] + +-- !old_sql -- +[1.0, 2.0, -1.0, -2.0, 0.3, 0.7, null] + +-- !old_sql -- +\N + +-- !old_sql -- +\N + +-- !old_sql -- +[1, 2, 3, 4] + +-- !old_sql -- +[1, 2, 3, 4] + +-- !old_sql -- +[] + +-- !old_sql -- +["abc", "def", "gh", "qwe"] + +-- !old_sql -- +[1, null, 2, 3, null, 4] + +-- !old_sql -- +[1, null, 2, 3, 4] + +-- !old_sql -- +\N + +-- !old_sql -- +\N + +-- !old_sql -- +\N + +-- !old_sql -- +\N + +-- !old_sql -- +\N + +-- !old_sql -- +[2, 3, 4] + +-- !old_sql -- +[] + +-- !old_sql -- +[3, 4] + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[2, null, 4, 5] + +-- !old_sql -- +["b", "c", "d"] + +-- !old_sql -- +["b", null, "d"] + +-- !old_sql -- +\N + +-- !old_sql -- +[1, 1] + +-- !old_sql -- +[null, 1] + +-- !old_sql -- +[0.5, 0.7, 0.1] + +-- !old_sql -- +[1, -1] + +-- !old_sql -- +["a", "b", "cd"] + +-- !old_sql -- +[1] + +-- !old_sql -- +[-1] + +-- !old_sql -- +\N + +-- !old_sql -- +[1, 1] + +-- !old_sql -- +[1, null] + +-- !old_sql -- +[0.1, 0.5, 0.7] + +-- !old_sql -- +[-1, 1] + +-- !old_sql -- +["cd", "a", "b"] + +-- !old_sql -- +[1] + +-- !old_sql -- +[1] + +-- !old_sql -- +\N + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[1, 2] + +-- !old_sql -- +[0.1, 0.2] + +-- !old_sql -- +["a", "b"] + +-- !old_sql -- +\N + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[2, 3] + +-- !old_sql -- +[0.2, 0.3] + +-- !old_sql -- +["b", "c"] + +-- !old_sql -- +\N +["0", "1", "2", "3"] +["0", "1", "2"] +["0", "1", "2"] +["0", "1", "2"] +["0", "1"] +["0", "1"] +["0", "1"] +["0"] +["0"] +["0"] +[] + +-- !sql -- +array_difference + +-- !old_sql -- +[0, -9223372036854841344] + +-- !old_sql -- +[0, -9] + +-- !old_sql -- +[0, -9] + +-- !old_sql -- +[0, -9] + +-- !old_sql -- +[0, -2147483747] + +-- !sql -- +array-join + +-- !nereid_sql -- +Hello, World + +-- !nereid_sql -- +\N + +0 +01 +012 +0123 +01234 +012345 +0123456 +01234567 + +-- !nereid_sql -- +\N + +0 +0,1 +0,1,2 +0,1,2,3 +0,1,2,3,4 +0,1,2,3,4,5 +0,1,2,3,4,5,6 +0,1,2,3,4,5,6,7 + +-- !nereid_sql -- +\N + + + +0 +0 +0_1 +0_1 +0_1_2 +0_1_2 + +-- !nereid_sql -- +hello;world;xyz;def + +-- !nereid_sql -- +1;23;456 + +-- !nereid_sql -- +1;23;456 + +-- !sql -- +array_with_constant + +-- !nereid_sql -- +[0, 0, 0] +[1, 1, 1] +[2, 2, 2] +[3, 3, 3] +[4, 4, 4] +[5, 5, 5] +[6, 6, 6] +[7, 7, 7] +[8, 8, 8] +[null, null, null] + +-- !nereid_sql -- +["Hello", "Hello", "Hello", "Hello", "Hello", "Hello", "Hello", "Hello"] +["Hello", "Hello", "Hello", "Hello", "Hello", "Hello", "Hello"] +["Hello", "Hello", "Hello", "Hello", "Hello", "Hello"] +["Hello", "Hello", "Hello", "Hello", "Hello"] +["Hello", "Hello", "Hello", "Hello"] +["Hello", "Hello", "Hello"] +["Hello", "Hello"] +["Hello"] +[] +[] + +-- !sql -- +[[], [], [], [], [], [], [], []] +[[], [], [], [], [], [], []] +[[], [], [], [], [], []] +[[], [], [], [], []] +[[], [], [], []] +[[], [], []] +[[], []] +[[]] +[] +[] + +-- !nereid_sql -- +["qwerty", "qwerty"] [] [1] + +-- !sql -- +array_intersect-array-sort + +-- !nereid_sql -- +[1, 2] +[1, 2] +[1] +[] + +-- !nereid_sql -- +[] +[] +[] +[] + +-- !nereid_sql -- +[] +[] +[] +[] + +-- !nereid_sql -- +[1, 2] +[1, 2] +[1] +[] + +-- !nereid_sql -- +[1, 2] +[1, 2] +[1, 2] +[1, 2] + +-- !nereid_sql -- +[] +[] +[] +[] + +-- !nereid_sql -- +[1, 2] +[1, 2] +[1] +[] + +-- !nereid_sql -- +[] +[] +[] +[] + +-- !nereid_sql -- +[] +[] +[] +[] + +-- !nereid_sql -- +[1, 2] +[1, 2] +[1] +[] + +-- !nereid_sql -- +[1, 2] +[1, 2] +[1, 2] +[1, 2] + +-- !nereid_sql -- +[] +[] +[] +[] + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +["a"] + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +[1] + +-- !sql -- +array_element_at + +-- !nereid_sql -- +\N +\N +\N +\N +\N +\N +\N +\N +\N +\N +\N +\N + +-- !nereid_sql -- +\N +\N +\N +\N +\N +\N +\N +\N +\N +\N +\N +\N + +-- !sql -- +\N +0 +1 +10 +2 +3 +4 +5 +6 +7 +8 +9 + +-- !nereid_sql -- +\N +true + +-- !nereid_sql -- +\N +\N +\N +1 +1 +1 +1 +1 +1 +1 + +-- !nereid_sql -- +\N +\N +0 +1 +2 +3 +4 +5 +6 +7 + +-- !nereid_sql -- +\N +\N +0 +1 +2 +3 +4 +5 +6 +7 + +-- !nereid_sql -- +\N +\N +\N +[0] +[0] +[0] +[0] +[0] +[0] +[0] + +-- !nereid_sql -- +\N +\N +[0, 1, 2, 3, 4, 5, 6] +[0, 1, 2, 3, 4, 5] +[0, 1, 2, 3, 4] +[0, 1, 2, 3] +[0, 1, 2] +[0, 1] +[0] +[] + +-- !nereid_sql -- +\N +\N +[0, 1, 2, 3, 4, 5, 6] +[0, 1, 2, 3, 4, 5] +[0, 1, 2, 3, 4] +[0, 1, 2, 3] +[0, 1, 2] +[0, 1] +[0] +[] + +-- !sql -- +array_concat_slice_push_back_push_front_pop_back_pop_front + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +[null] + +-- !nereid_sql -- +[null, 1] + +-- !nereid_sql -- +[1.0, 2.0, -1.0, -2.0, 0.3, 0.7, null] + +-- !nereid_sql -- +\N + +-- !nereid_sql -- +\N + +-- !nereid_sql -- +[1, 2, 3, 4] + +-- !nereid_sql -- +[1, 2, 3, 4] + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +["abc", "def", "gh", "qwe"] + +-- !nereid_sql -- +[1, null, 2, 3, null, 4] + +-- !nereid_sql -- +[1, null, 2, 3, 4] + +-- !nereid_sql -- +\N + +-- !nereid_sql -- +\N + +-- !nereid_sql -- +\N + +-- !nereid_sql -- +\N + +-- !nereid_sql -- +\N + +-- !nereid_sql -- +[2, 3, 4] + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +[3, 4] + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +[2, null, 4, 5] + +-- !nereid_sql -- +["b", "c", "d"] + +-- !nereid_sql -- +["b", null, "d"] + +-- !nereid_sql -- +\N + +-- !nereid_sql -- +[1, 1] + +-- !nereid_sql -- +[null, 1] + +-- !nereid_sql -- +[0.5, 0.7, 1.0] + +-- !nereid_sql -- +[1, -1] + +-- !nereid_sql -- +["a", "b", "cd"] + +-- !nereid_sql -- +[1] + +-- !nereid_sql -- +[-1] + +-- !nereid_sql -- +\N + +-- !nereid_sql -- +[1, 1] + +-- !nereid_sql -- +[1, null] + +-- !nereid_sql -- +[1.0, 0.5, 0.7] + +-- !nereid_sql -- +[-1, 1] + +-- !nereid_sql -- +["cd", "a", "b"] + +-- !nereid_sql -- +[1] + +-- !nereid_sql -- +[-1] + +-- !nereid_sql -- +\N + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +[1, 2] + +-- !nereid_sql -- +[0.1, 0.2] + +-- !nereid_sql -- +["a", "b"] + +-- !nereid_sql -- +\N + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +[] + +-- !nereid_sql -- +[2, 3] + +-- !nereid_sql -- +[0.2, 0.3] + +-- !nereid_sql -- +["b", "c"] + +-- !nereid_sql -- +\N +["0", "1", "2", "3"] +["0", "1", "2"] +["0", "1", "2"] +["0", "1", "2"] +["0", "1"] +["0", "1"] +["0", "1"] +["0"] +["0"] +["0"] +[] + +-- !sql -- +array_difference + +-- !nereid_sql -- +[0, -9223372036854841344] + +-- !nereid_sql -- +[0, -9] + +-- !nereid_sql -- +[0, -9] + +-- !nereid_sql -- +[0, -9] + +-- !nereid_sql -- +[0, -2147483747] + diff --git a/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_push_pop_backfront.out b/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_push_pop_backfront.out new file mode 100644 index 00000000000..5e3bdf33f9c --- /dev/null +++ b/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_push_pop_backfront.out @@ -0,0 +1,91 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !old_sql -- +array_pushback-pushfrony + +-- !old_sql -- +\N + +-- !old_sql -- +[1, 1] + +-- !old_sql -- +[null, 1] + +-- !old_sql -- +[0.5, 0.7, 0.1] + +-- !old_sql -- +[1, -1] + +-- !old_sql -- +["a", "b", "cd"] + +-- !old_sql -- +[1] + +-- !old_sql -- +[-1] + +-- !old_sql -- +\N + +-- !old_sql -- +[1, 1] + +-- !old_sql -- +[1, null] + +-- !old_sql -- +[0.1, 0.5, 0.7] + +-- !old_sql -- +[-1, 1] + +-- !old_sql -- +["cd", "a", "b"] + +-- !old_sql -- +[1] + +-- !old_sql -- +[1] + +-- !old_sql -- +array_popback-popfront + +-- !old_sql -- +\N + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[1, 2] + +-- !old_sql -- +[0.1, 0.2] + +-- !old_sql -- +["a", "b"] + +-- !old_sql -- +\N + +-- !old_sql -- +[] + +-- !old_sql -- +[] + +-- !old_sql -- +[2, 3] + +-- !old_sql -- +[0.2, 0.3] + +-- !old_sql -- +["b", "c"] + diff --git a/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_zip_array_enumerate_uniq.out b/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_zip_array_enumerate_uniq.out new file mode 100644 index 00000000000..9aadb17bd0b --- /dev/null +++ b/regression-test/data/datatype_p0/nested_types/query/array_functions/test_array_zip_array_enumerate_uniq.out @@ -0,0 +1,13 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !sql -- +array_enumerate_uniq + +-- !old_sql -- +[1, 1, 2] + +-- !old_sql -- +[1, 1, 1] + +-- !old_sql -- +[1] + diff --git a/regression-test/data/query_p0/sql_functions/array_functions/test_array_functions_of_array_countEqual.out b/regression-test/data/query_p0/sql_functions/array_functions/test_array_functions_of_array_countEqual.out index e37152e56f9..819d42ce334 100644 --- a/regression-test/data/query_p0/sql_functions/array_functions/test_array_functions_of_array_countEqual.out +++ b/regression-test/data/query_p0/sql_functions/array_functions/test_array_functions_of_array_countEqual.out @@ -11,3 +11,15 @@ 9 [null, null, null] 0 0 3 10 [1, 2, 3, 4, 5, 5, 5] 1 3 0 +-- !select -- +false +false +false +false +false +false +false +\N +false +false + diff --git a/regression-test/data/query_p0/sql_functions/array_functions/test_array_functions_of_array_difference.out b/regression-test/data/query_p0/sql_functions/array_functions/test_array_functions_of_array_difference.out index 5dccdce4a9d..afdad5f9500 100644 --- a/regression-test/data/query_p0/sql_functions/array_functions/test_array_functions_of_array_difference.out +++ b/regression-test/data/query_p0/sql_functions/array_functions/test_array_functions_of_array_difference.out @@ -8,3 +8,9 @@ 6 [1, 2, 3, 4, 5, 4, 3, 2, 1] [0, 1, 1, 1, 1, -1, -1, -1, -1] 7 [1111, 12324, 8674, 123, 3434, 435, 45, 53, 54, 2] [0, 11213, -3650, -8551, 3311, -2999, -390, 8, 1, -52] +-- !select -- +[0, 1, 1, 1] + +-- !select -- +[0, 6, 93, -95] + diff --git a/regression-test/suites/datatype_p0/nested_types/query/array_functions/load.groovy b/regression-test/suites/datatype_p0/nested_types/query/array_functions/load.groovy new file mode 100644 index 00000000000..b138b10cdf4 --- /dev/null +++ b/regression-test/suites/datatype_p0/nested_types/query/array_functions/load.groovy @@ -0,0 +1,22 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +suite("load") { + sql "drop table if exists numbers;" + sql "create table if not exists numbers (number int) ENGINE=OLAP DISTRIBUTED BY HASH(number) BUCKETS 1 PROPERTIES('replication_num' = '1');" + sql "insert into numbers values (NULL), (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);" +} diff --git a/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_element_at_and_slice.groovy b/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_element_at_and_slice.groovy new file mode 100644 index 00000000000..a03bf587cdf --- /dev/null +++ b/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_element_at_and_slice.groovy @@ -0,0 +1,75 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +suite("test_array_element_at_and_slice", "p0") { + sql "set enable_nereids_planner=false;" + + // ============= array element_at ========= + // ubsan test + qt_old_sql "SELECT 'array_element_at';" + order_qt_old_sql "SELECT array(number)[10000000000] FROM numbers;" + order_qt_old_sql " SELECT array(number)[-10000000000] FROM numbers;" + // doris can not parse -0x8000000000000000 to 9223372036854775808 && 0xFFFFFFFFFFFFFFFF to 18446744073709551615 +// order_qt_sql " SELECT array(number)[-0x8000000000000000] FROM numbers;" +// order_qt_sql " SELECT array(number)[0xFFFFFFFFFFFFFFFF] FROM numbers;" + // mistake detailMessage = Number out of range[18446744073709551615]. type: BIGINT + // order_qt_sql " SELECT array(number)[18446744073709551615] FROM numbers;" + + + // predict not support action + test { + sql """ + SELECT array_range(100) = array_range(0, 100); + """ + exception("errCode = 2") + } + + order_qt_old_sql "SELECT distinct size(array_range(number, number + 100, 99))=2 FROM numbers;" + order_qt_old_sql "SELECT array_map(x -> cast(x as string), array_range(number))[2] FROM numbers LIMIT 10;" + order_qt_old_sql "SELECT array_map(x -> cast(x as string), array_range(number))[-1] FROM numbers LIMIT 10;" + order_qt_old_sql "SELECT array_map(x -> cast(x as string), array_range(number))[number] FROM numbers LIMIT 10;" + order_qt_old_sql "SELECT array_map(x -> array_range(x), array_range(number))[2] FROM numbers LIMIT 10;" + order_qt_old_sql "SELECT array_map(x -> array_range(x), array_range(number))[-1] FROM numbers LIMIT 10;" + order_qt_old_sql "SELECT array_map(x -> array_range(x), array_range(number))[number] FROM numbers LIMIT 10;" + + qt_old_sql "SELECT 'array_slice';" + // mistake: detailMessage = No matching function with signature: array_slice(NULL_TYPE, TINYINT, TINYINT). +// order_qt_sql "SELECT array_slice(Null, 1, 2);" + order_qt_old_sql "SELECT array_slice([1, 2, 3, 4, 5, 6], Null, Null);" + order_qt_old_sql "SELECT array_slice([1, 2, 3, 4, 5, 6], 2, Null);" + order_qt_old_sql "SELECT array_slice([1, 2, 3, 4, 5, 6], Null, 4);" + order_qt_old_sql "SELECT array_slice([1, 2, 3, 4, 5, 6], Null, -2);" + order_qt_old_sql "SELECT array_slice([1, 2, 3, 4, 5, 6], -3, Null);" + order_qt_old_sql "SELECT array_slice([1, 2, 3, 4, 5, 6], 2, 3);" + order_qt_old_sql "SELECT array_slice([1, 2, 3, 4, 5, 6], 2, -2);" + order_qt_old_sql "SELECT array_slice([1, 2, 3, 4, 5, 6], -4, 2);" + order_qt_old_sql "SELECT array_slice([1, 2, 3, 4, 5, 6], -4, -2);" + order_qt_old_sql "SELECT array_slice([1, 2, 3, 4, 5, 6], 2, 0);" + order_qt_old_sql "SELECT array_slice([1, 2, 3, 4, 5, 6], -10, 15);" + order_qt_old_sql "SELECT array_slice([1, 2, 3, 4, 5, 6], -15, 10);" + order_qt_old_sql "SELECT array_slice([1, 2, 3, 4, 5, 6], -15, 9);" + order_qt_old_sql "SELECT array_slice([1, 2, 3, 4, 5, 6], 10, 0);" + order_qt_old_sql "SELECT array_slice([1, 2, 3, 4, 5, 6], 10, -1);" + order_qt_old_sql "SELECT array_slice([1, 2, 3, 4, 5, 6], 10, 1);" + order_qt_old_sql "SELECT array_slice([1, 2, Null, 4, 5, 6], 2, 4);" + order_qt_old_sql "SELECT array_slice(['a', 'b', 'c', 'd', 'e'], 2, 3);" + order_qt_old_sql "SELECT array_slice([Null, 'b', Null, 'd', 'e'], 2, 3);" + // not support nested complex type + // order_qt_sql "SELECT array_slice([], [NULL], NULL), 1 from numbers limit 2;" + + // nereids +} diff --git a/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_functions_array_intersect_sort.groovy b/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_functions_array_intersect_sort.groovy new file mode 100644 index 00000000000..9f6d1dae9b1 --- /dev/null +++ b/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_functions_array_intersect_sort.groovy @@ -0,0 +1,134 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +suite("test_array_functions_array_intersect_sort", "p0") { + + sql "set enable_nereids_planner=false;" + // ========= array_intersect =========== + // with sort + qt_oLd_sql "SELECT 'array_intersect-array-sort';" + sql "drop table if exists tbl_array_intersect;" + sql "create table tbl_array_intersect (date Date, arr Array<Int>) ENGINE=OLAP DISTRIBUTED BY HASH(date) BUCKETS 1 PROPERTIES('replication_num' = '1');" + + sql "insert into tbl_array_intersect values ('2019-01-01', [1,2,3]);" + sql "insert into tbl_array_intersect values ('2019-01-02', [1,2]);" + sql "insert into tbl_array_intersect values ('2019-01-03', [1]);" + sql "insert into tbl_array_intersect values ('2019-01-04', []);" + + order_qt_old_sql "SELECT array_sort(array_intersect(arr, [1,2])) from tbl_array_intersect order by date;" + order_qt_old_sql "SELECT array_sort(array_intersect(arr, [])) from tbl_array_intersect order by date;" + order_qt_old_sql "SELECT array_sort(array_intersect([], arr)) from tbl_array_intersect order by date;" + order_qt_old_sql "SELECT array_sort(array_intersect([1,2], arr)) from tbl_array_intersect order by date;" + order_qt_old_sql "SELECT array_sort(array_intersect([1,2], [1,2,3,4])) from tbl_array_intersect order by date;" + order_qt_old_sql "SELECT array_sort(array_intersect([], [])) from tbl_array_intersect order by date;" + + + order_qt_old_sql "SELECT array_sort(array_intersect(arr, [1,2])) from tbl_array_intersect order by date;" + order_qt_old_sql "SELECT array_sort(array_intersect(arr, [])) from tbl_array_intersect order by date;" + order_qt_old_sql "SELECT array_sort(array_intersect([], arr)) from tbl_array_intersect order by date;" + order_qt_old_sql "SELECT array_sort(array_intersect([1,2], arr)) from tbl_array_intersect order by date;" + order_qt_old_sql "SELECT array_sort(array_intersect([1,2], [1,2,3,4])) from tbl_array_intersect order by date;" + order_qt_old_sql "SELECT array_sort(array_intersect([], [])) from tbl_array_intersect order by date;" + + + order_qt_old_sql "SELECT array_sort(array_intersect([-100], [156]));" + order_qt_old_sql "SELECT array_sort(array_intersect([1], [257]));" + + order_qt_old_sql "SELECT array_sort(array_intersect(['a', 'b', 'c'], ['a', 'a']));" + order_qt_old_sql "SELECT array_sort(array_intersect([1, 1], [2, 2]));" + order_qt_old_sql "SELECT array_sort(array_intersect([1, 1], [1, 2]));" + // nereids not support array_intersect with three argument + order_qt_old_sql "SELECT array_sort(array_intersect([1, 1, 1], [3], [2, 2, 2]));" + order_qt_old_sql "SELECT array_sort(array_intersect([1, 2], [1, 2], [2]));" + order_qt_old_sql "SELECT array_sort(array_intersect([1, 1], [2, 1], [2, 2], [1]));" + order_qt_old_sql "SELECT array_sort(array_intersect([1, 1], [2, 1], [2, 2], [2, 2, 2]));" + + // nereids not support array_intersect with one argument + test { + sql """ + SELECT array_sort(array_intersect([])); + """ + exception("errCode = 2") + } + test { + sql """ + SELECT array_sort(array_intersect([1, 2, 3])); + """ + exception("errCode = 2") + } + + // nereids + sql "set enable_nereids_planner=true;" + sql "set enable_fallback_to_original_planner=false;" + + + // ========= array_intersect =========== + // with sort + qt_nereid_sql "SELECT 'array_intersect-array-sort';" + sql "drop table if exists tbl_array_intersect;" + sql "create table tbl_array_intersect (date Date, arr Array<Int>) ENGINE=OLAP DISTRIBUTED BY HASH(date) BUCKETS 1 PROPERTIES('replication_num' = '1');" + + sql "insert into tbl_array_intersect values ('2019-01-01', [1,2,3]);" + sql "insert into tbl_array_intersect values ('2019-01-02', [1,2]);" + sql "insert into tbl_array_intersect values ('2019-01-03', [1]);" + sql "insert into tbl_array_intersect values ('2019-01-04', []);" + + order_qt_nereid_sql "SELECT array_sort(array_intersect(arr, [1,2])) from tbl_array_intersect order by date;" + order_qt_nereid_sql "SELECT array_sort(array_intersect(arr, [])) from tbl_array_intersect order by date;" + order_qt_nereid_sql "SELECT array_sort(array_intersect([], arr)) from tbl_array_intersect order by date;" + order_qt_nereid_sql "SELECT array_sort(array_intersect([1,2], arr)) from tbl_array_intersect order by date;" + order_qt_nereid_sql "SELECT array_sort(array_intersect([1,2], [1,2,3,4])) from tbl_array_intersect order by date;" + order_qt_nereid_sql "SELECT array_sort(array_intersect([], [])) from tbl_array_intersect order by date;" + + + order_qt_nereid_sql "SELECT array_sort(array_intersect(arr, [1,2])) from tbl_array_intersect order by date;" + order_qt_nereid_sql "SELECT array_sort(array_intersect(arr, [])) from tbl_array_intersect order by date;" + order_qt_nereid_sql "SELECT array_sort(array_intersect([], arr)) from tbl_array_intersect order by date;" + order_qt_nereid_sql "SELECT array_sort(array_intersect([1,2], arr)) from tbl_array_intersect order by date;" + order_qt_nereid_sql "SELECT array_sort(array_intersect([1,2], [1,2,3,4])) from tbl_array_intersect order by date;" + order_qt_nereid_sql "SELECT array_sort(array_intersect([], [])) from tbl_array_intersect order by date;" + + + order_qt_nereid_sql "SELECT array_sort(array_intersect([-100], [156]));" + order_qt_nereid_sql "SELECT array_sort(array_intersect([1], [257]));" + + order_qt_nereid_sql "SELECT array_sort(array_intersect(['a', 'b', 'c'], ['a', 'a']));" + order_qt_nereid_sql "SELECT array_sort(array_intersect([1, 1], [2, 2]));" + order_qt_nereid_sql "SELECT array_sort(array_intersect([1, 1], [1, 2]));" + // nereids not support array_intersect with three argument +// order_qt_nereid_sql "SELECT array_sort(array_intersect([1, 1, 1], [3], [2, 2, 2]));" +// order_qt_nereid_sql "SELECT array_sort(array_intersect([1, 2], [1, 2], [2]));" +// order_qt_nereid_sql "SELECT array_sort(array_intersect([1, 1], [2, 1], [2, 2], [1]));" +// order_qt_nereid_sql "SELECT array_sort(array_intersect([1, 1], [2, 1], [2, 2], [2, 2, 2]));" +// +// // nereids not support array_intersect with one argument +// try { +// sql """ +// SELECT array_sort(array_intersect([])); +// """ +// } catch (Exception ex) { +// assertTrue(ex.getMessage().contains("No matching function with signature: array_intersect(ARRAY<NULL_TYPE>)")) +// } +// try { +// sql """ +// SELECT array_sort(array_intersect([1, 2, 3])); +// """ +// } catch (Exception ex) { +// assertTrue(ex.getMessage().contains("No matching function with signature: array_intersect(ARRAY<TINYINT>)")) +// } + +} diff --git a/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_functions_array_join.groovy b/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_functions_array_join.groovy new file mode 100644 index 00000000000..786400668c7 --- /dev/null +++ b/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_functions_array_join.groovy @@ -0,0 +1,59 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +suite("test_array_functions_array_join", "p0") { + + sql "set enable_nereids_planner=false;" + // ============= array join ========= + qt_old_sql "SELECT 'array-join';" + // only support array_join with two arguments + // order_qt_sql "SELECT array_join(['Hello', 'World']);" + order_qt_old_sql "SELECT array_join(['Hello', 'World'], ', ');" + // order_qt_sql "SELECT array_join([]);" + // order_qt_sql "SELECT array_join(array_range(number)) FROM numbers LIMIT 10;" + order_qt_old_sql "SELECT array_join(array_range(number), '') FROM numbers LIMIT 10;" + order_qt_old_sql "SELECT array_join(array_range(number), ',') FROM numbers LIMIT 10;" + order_qt_old_sql "SELECT array_join(array_range(number % 4), '_') FROM numbers LIMIT 10;" + order_qt_old_sql "SELECT array_join([Null, 'hello', Null, 'world', Null, 'xyz', 'def', Null], ';');" + order_qt_old_sql "SELECT array_join([1, 23, 456], ';');" + order_qt_old_sql "SELECT array_join([Null, 1, Null, 23, Null, 456, Null], ';');" + // array with ip type make mistake + // old planner +// mysql> select array(cast('127.0.0.1' as ipv4), Null); +// ERROR 1105 (HY000): errCode = 2, detailMessage = (172.21.16.12)[CANCELLED]Conversion from IPv4 to Decimal(27, 9) is not supported + // array_join mistake + // old planner +// mysql> select array_join(array(cast('127.0.0.1' as ipv4), Null, cast('1.0.0.1' as ipv4)), ','); +// ERROR 1105 (HY000): errCode = 2, detailMessage = (172.21.16.12)[CANCELLED]Conversion from IPv4 to Decimal(27, 9) is not supported + // nereids +// mysql> select array_join(array(cast('127.0.0.1' as ipv4), Null, cast('1.0.0.1' as ipv4)), ','); +// ERROR 1105 (HY000): errCode = 2, detailMessage = (172.21.16.12)[CANCELLED]execute failed or unsupported types for function array_join(Array(Nullable(IPv4)),String,) + + // nereids + // array with ip type make mistake + // old planner +// mysql> select array(cast('127.0.0.1' as ipv4), Null); +// ERROR 1105 (HY000): errCode = 2, detailMessage = (172.21.16.12)[CANCELLED]Conversion from IPv4 to Decimal(27, 9) is not supported + // array_join mistake + // old planner +// mysql> select array_join(array(cast('127.0.0.1' as ipv4), Null, cast('1.0.0.1' as ipv4)), ','); +// ERROR 1105 (HY000): errCode = 2, detailMessage = (172.21.16.12)[CANCELLED]Conversion from IPv4 to Decimal(27, 9) is not supported + // nereids +// mysql> select array_join(array(cast('127.0.0.1' as ipv4), Null, cast('1.0.0.1' as ipv4)), ','); +// ERROR 1105 (HY000): errCode = 2, detailMessage = (172.21.16.12)[CANCELLED]execute failed or unsupported types for function array_join(Array(Nullable(IPv4)),String,) + +} diff --git a/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_functions_array_with_const.groovy b/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_functions_array_with_const.groovy new file mode 100644 index 00000000000..7101a8c68bc --- /dev/null +++ b/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_functions_array_with_const.groovy @@ -0,0 +1,42 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +suite("test_array_functions_array_with_const", "p0") { + + sql "set enable_nereids_planner=false;" + + //array_with_constant + qt_old_sql "SELECT 'array_with_constant';" + order_qt_old_sql "SELECT array_with_constant(3, number) FROM numbers limit 10;" + order_qt_old_sql "SELECT array_with_constant(number, 'Hello') FROM numbers limit 10;" + // not support const expression +// order_qt_sql "SELECT array_with_constant(number % 3, number % 2 ? 'Hello' : NULL) FROM numbers limit 10;" + // mistake:No matching function with signature: array_with_constant(INT, ARRAY<NULL_TYPE>) +// order_qt_sql "SELECT array_with_constant(number, []) FROM numbers limit 10;" + order_qt_old_sql "SELECT array_with_constant(2, 'qwerty'), array_with_constant(0, -1), array_with_constant(1, 1);" + // -- { serverError } + test { + sql """ + SELECT array_with_constant(-231.37104, -138); + """ + exception("errCode = 2") + } + + + // nereids + +} diff --git a/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_functions_concat_compact_difference.groovy b/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_functions_concat_compact_difference.groovy new file mode 100644 index 00000000000..fe6673ddd85 --- /dev/null +++ b/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_functions_concat_compact_difference.groovy @@ -0,0 +1,72 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +suite("test_array_functions_concat_compact_difference", "p0") { + sql "set enable_nereids_planner=false;" + + qt_old_sql "SELECT 'array_concat'" + + order_qt_old_sql "SELECT array_concat([]);" + order_qt_old_sql "SELECT array_concat([], []);" + order_qt_old_sql "SELECT array_concat([], [], []);" + order_qt_old_sql "SELECT array_concat([Null], []);" + order_qt_old_sql "SELECT array_concat([Null], [], [1]);" + order_qt_old_sql "SELECT array_concat([1, 2], [-1, -2], [0.3, 0.7], [Null]);" + order_qt_old_sql "SELECT array_concat(Null, []);" + order_qt_old_sql "SELECT array_concat([1], [-1], Null);" + order_qt_old_sql "SELECT array_concat([1, 2], [3, 4]);" + order_qt_old_sql "SELECT array_concat([1], [2, 3, 4]);" + order_qt_old_sql "SELECT array_concat([], []);" + order_qt_old_sql " SELECT array_concat(['abc'], ['def', 'gh', 'qwe']);" + order_qt_old_sql " SELECT array_concat([1, NULL, 2], [3, NULL, 4]);" + order_qt_old_sql "SELECT array_concat([1, Null, 2], [3, 4]);" + + + // ============= array_compact ========= + qt_old_sql "SELECT 'array_compact';" + // this sql make be core for overflow + // order_qt_sql "SELECT array_compact([[[]], [[], []], [[], []], [[]]]);" + order_qt_old_sql "SELECT array_compact(array_map(x -> cast((x DIV 3) as string), array_range(number))) FROM numbers;" + // this sql old planner make error "Lambda columnref size: is 0 but input params size is 1. the replaceExpr of columnref is ," + // nereids will make be canceled with error + // 1105 (HY000): errCode = 2, detailMessage = [CANCELLED]const check failed, expr=VectorizedFn[VectorizedFnCall[array_compact](arguments=array_map({"vlambda_function_expr", "Array(Nullable(UInt8))"}),return=Array(Nullable(Int8)))]{ + // VLambdaFunctionCallExpr[array_map({"vlambda_function_expr", "Array(Nullable(UInt8))"})]{ + // type=LAMBDA_FUNCTION TYPE children=[VLiteral (name = Int8, type = Int8, value = (0))], + // VLiteral (name = Array(Nullable(UInt8)), type = Array(Nullable(UInt8)), value = ([NULL]))}} + // order_qt_sql "SELECT array_compact(array_map(x -> 0, [NULL]));" + // order_qt_sql "SELECT cast(array_compact(array_map(x->0, [NULL])) as string);" +// order_qt_sql "SELECT array_compact(x -> x.2, groupArray((number, intDiv(number, 3) % 3))) FROM numbers limit 10;" +// order_qt_sql "SELECT array_compact(x -> x.2, groupArray((toString(number), toString(intDiv(number, 3) % 3)))) FROM numbers limit 10;" +// order_qt_sql "SELECT array_compact(x -> x.2, groupArray((toString(number), intDiv(number, 3) % 3))) FROM numbers limit 10;" + + // ============= array_difference ========= + // Overflow is Ok and behaves as the CPU does it. + qt_old_sql "SELECT 'array_difference';" + order_qt_old_sql "SELECT array_difference([65536, -9223372036854775808]);" + // Diff of unsigned int -> int + order_qt_old_sql "SELECT array_difference( cast([10, 1] as Array<int>));" + order_qt_old_sql "SELECT array_difference( cast([10, 1] as Array<BIGINT>));" + order_qt_old_sql "SELECT array_difference( cast([10, 1] as Array<LargeInt>));" + + // now we not support array with in/comparable predict +// order_qt_sql "SELECT [1] < [1000], ['abc'] = [NULL], ['abc'] = [toNullable('abc')], [[]] = [[]], [[], [1]] > [[], []], [[1]] < [[], []], [[], []] > [[]],[([], ([], []))] < [([], ([], ['hello']))];" + + order_qt_old_sql "SELECT array_difference(array(cast(100.0000991821289 as Decimal), -2147483647)) AS x;" + + + +} diff --git a/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_push_pop_backfront.groovy b/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_push_pop_backfront.groovy new file mode 100644 index 00000000000..f073df7aee1 --- /dev/null +++ b/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_push_pop_backfront.groovy @@ -0,0 +1,59 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +suite("test_array_push_pop_backfront", "p0") { + + sql "set enable_nereids_planner=false;" + + qt_old_sql "SELECT 'array_pushback-pushfrony'" + order_qt_old_sql "SELECT array_pushback(Null, 1);" + order_qt_old_sql "SELECT array_pushback([1], 1);" + order_qt_old_sql "SELECT array_pushback([Null], 1);" + order_qt_old_sql "SELECT array_pushback([0.5, 0.7], 1);" + order_qt_old_sql "SELECT array_pushback([1], -1);" + order_qt_old_sql "SELECT array_pushback(['a', 'b'], 'cd');" + order_qt_old_sql "SELECT array_pushback([], 1);" + order_qt_old_sql "SELECT array_pushback([], -1);" + + order_qt_old_sql "SELECT array_pushfront(Null, 1);" + order_qt_old_sql "SELECT array_pushfront([1], 1);" + order_qt_old_sql "SELECT array_pushfront([Null], 1);" + order_qt_old_sql "SELECT array_pushfront([0.5, 0.7], 1);" + order_qt_old_sql "SELECT array_pushfront([1], -1);" + order_qt_old_sql "SELECT array_pushfront(['a', 'b'], 'cd');" + order_qt_old_sql "SELECT array_pushfront([], 1);" + order_qt_old_sql "SELECT array_pushfront([], -1);" + + qt_old_sql "SELECT 'array_popback-popfront'" + order_qt_old_sql "SELECT array_popback(Null);" + order_qt_old_sql "SELECT array_popback([]);" + order_qt_old_sql "SELECT array_popback([1]);" + order_qt_old_sql "SELECT array_popback([1, 2, 3]);" + order_qt_old_sql "SELECT array_popback([0.1, 0.2, 0.3]);" + order_qt_old_sql "SELECT array_popback(['a', 'b', 'c']);" + + order_qt_old_sql "SELECT array_popfront(Null);" + order_qt_old_sql "SELECT array_popfront([]);" + order_qt_old_sql "SELECT array_popfront([1]);" + order_qt_old_sql "SELECT array_popfront([1, 2, 3]);" + order_qt_old_sql "SELECT array_popfront([0.1, 0.2, 0.3]);" + order_qt_old_sql "SELECT array_popfront(['a', 'b', 'c']);" + + + // nereids + +} diff --git a/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_zip_array_enumerate_uniq.groovy b/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_zip_array_enumerate_uniq.groovy new file mode 100644 index 00000000000..aaf96a0e695 --- /dev/null +++ b/regression-test/suites/datatype_p0/nested_types/query/array_functions/test_array_zip_array_enumerate_uniq.groovy @@ -0,0 +1,75 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +suite("test_array_zip_array_enumerate_uniq", "p0") { + + + sql "set enable_nereids_planner=false;" +// ========== array-zip ========== +// wrong case + test { + sql """ + SELECT array_zip(); + """ + exception("errCode = 2") + } + + test { + sql """ + SELECT array_zip(['a', 'b', 'c'], ['d', 'e', 'f', 'd']); + """ + exception("errCode = 2") + } + + // ============= array_enumerate_uniq ========= + qt_sql "SELECT 'array_enumerate_uniq';" + sql """ set enable_fold_constant_by_be=true; """ // if we enable_fold_constant_by_be=false, will meet cast error` + order_qt_old_sql """ SELECT array_enumerate_uniq(array_enumerate_uniq(array(cast(10 as LargeInt), cast(100 as LargeInt), cast(2 as LargeInt))), array(cast(123 as LargeInt), cast(1023 as LargeInt), cast(123 as LargeInt))); """ + + order_qt_old_sql """SELECT array_enumerate_uniq( + [111111, 222222, 333333], + [444444, 555555, 666666], + [111111, 222222, 333333], + [444444, 555555, 666666], + [111111, 222222, 333333], + [444444, 555555, 666666], + [111111, 222222, 333333], + [444444, 555555, 666666]);""" + order_qt_old_sql """SELECT array_enumerate_uniq(array(STDDEV_SAMP(910947.571364)), array(NULL)) from numbers;""" + //order_qt_sql """ SELECT max(array_join(arr)) FROM (SELECT array_enumerate_uniq(group_array(DIV(number, 54321)) AS nums, group_array(cast(DIV(number, 98765) as string))) AS arr FROM (SELECT number FROM numbers LIMIT 1000000) GROUP BY bitmap_hash(number) % 100000);""" + + // nereids + + // nereid not support array_enumerate_uniq + // ============= array_enumerate_uniq ========= +// qt_sql "SELECT 'array_enumerate_uniq';" +// order_qt_nereid_sql """ SELECT array_enumerate_uniq(array_enumerate_uniq(array(cast(10 as LargeInt), cast(100 as LargeInt), cast(2 as LargeInt))), array(cast(123 as LargeInt), cast(1023 as LargeInt), cast(123 as LargeInt))); """ +// +// order_qt_nereid_sql """SELECT array_enumerate_uniq( +// [111111, 222222, 333333], +// [444444, 555555, 666666], +// [111111, 222222, 333333], +// [444444, 555555, 666666], +// [111111, 222222, 333333], +// [444444, 555555, 666666], +// [111111, 222222, 333333], +// [444444, 555555, 666666]);""" +// order_qt_nereid_sql """SELECT array_enumerate_uniq(array(STDDEV_SAMP(910947.571364)), array(NULL)) from numbers;""" +// //order_qt_sql """ SELECT max(array_join(arr)) FROM (SELECT array_enumerate_uniq(group_array(DIV(number, 54321)) AS nums, group_array(cast(DIV(number, 98765) as string))) AS arr FROM (SELECT number FROM numbers LIMIT 1000000) GROUP BY bitmap_hash(number) % 100000);""" + + +} diff --git a/regression-test/suites/query_p0/sql_functions/array_functions/test_array_functions_of_array_countEqual.groovy b/regression-test/suites/query_p0/sql_functions/array_functions/test_array_functions_of_array_countEqual.groovy index d036697ce85..0f2074b71c1 100644 --- a/regression-test/suites/query_p0/sql_functions/array_functions/test_array_functions_of_array_countEqual.groovy +++ b/regression-test/suites/query_p0/sql_functions/array_functions/test_array_functions_of_array_countEqual.groovy @@ -43,5 +43,6 @@ suite("test_array_functions_of_array_countEqual") { sql """ INSERT INTO ${tableName} VALUES(10, [1, 2, 3, 4, 5, 5, 5]) """ qt_select "select *,countEqual(k2, 1),countEqual(k2, 5),countEqual(k2, NULL) from ${tableName} order by k1" + qt_select "select 7=countEqual(k2, 7) from ${tableName} order by k1" } diff --git a/regression-test/suites/query_p0/sql_functions/array_functions/test_array_functions_of_array_difference.groovy b/regression-test/suites/query_p0/sql_functions/array_functions/test_array_functions_of_array_difference.groovy index c98c17d2fce..19db8178729 100644 --- a/regression-test/suites/query_p0/sql_functions/array_functions/test_array_functions_of_array_difference.groovy +++ b/regression-test/suites/query_p0/sql_functions/array_functions/test_array_functions_of_array_difference.groovy @@ -41,4 +41,8 @@ suite("test_array_functions_of_array_difference") { qt_select "SELECT *, array_difference(k2) FROM ${tableName} order by k1" + // literal + qt_select "SELECT array_difference([1, 2, 3, 4]);" + qt_select "SELECT array_difference([1, 7, 100, 5]);" + } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org