From 5b5211d04f03c404c75b63e3a4163f139f04feef Mon Sep 17 00:00:00 2001 From: silverbullet233 <3675229+silverbullet233@users.noreply.github.com> Date: Mon, 10 Feb 2025 19:56:36 +0800 Subject: [PATCH] fix cases Signed-off-by: silverbullet233 <3675229+silverbullet233@users.noreply.github.com> --- .../test_agg_function/R/test_array_unique_agg | 55 +++++++++---------- .../test_agg_function/T/test_array_unique_agg | 10 ++-- 2 files changed, 31 insertions(+), 34 deletions(-) diff --git a/test/sql/test_agg_function/R/test_array_unique_agg b/test/sql/test_agg_function/R/test_array_unique_agg index fe70e23c9ef89c..de9af7ec6d1a13 100644 --- a/test/sql/test_agg_function/R/test_array_unique_agg +++ b/test/sql/test_agg_function/R/test_array_unique_agg @@ -68,86 +68,83 @@ PROPERTIES ("replication_num" = "1"); -- !result insert into test_array_agg values (1, [true, false, true], [10, 20, 10], [100, 200, 100], [1000, 2000, 1000], [10000, 20000, 10000], [100000, 200000, 100000], [1.1, 2.2, 1.1], [2.2, 3.3, 2.2], ['hello', 'world', 'hello'], ['char1', 'char2', 'char1'], ['2024-01-01 12:00:00', '2024-02-02 13:00:00', '2024-01-01 12:00:00'], ['2024-01-01', '2024-02-02', '2024-01-01'], [[1,2,3,1]], [map{"key1": 1, "key2": 2}], [row(1, "test1")]), -(2, [false, true, false], [20, 30, 20], [200, 300, 200], [2000, 3000, 2000], [20000, 30000, 20000], [200000, 300000, 200000], [3.3, 4.4, 3.3], [4.4, 5.5, 4.4], ['world', 'hello', 'world'], ['char2', 'char3', 'char2'], ['2024-02-02 13:00:00', '2024-03-03 14:00:00', '2024-02-02 13:00:00'], ['2024-02-02', '2024-03-03', '2024-02-02'], [[4,5,6,4]], [map{"key3": 3, "key4": 4}], [row(2, "test2")]); --- result: --- !result -(3, [false, true, false], [20, 30, 20], [200, 300, 200], [2000, 3000, 2000], [20000, 30000, 20000], [200000, 300000, 200000], [3.3, 4.4, 3.3], [4.4, 5.5, 4.4], ['world', 'hello', 'world'], ['char2', 'char3', 'char2'], ['2024-02-02 13:00:00', '2024-03-03 14:00:00', '2024-02-02 13:00:00'], ['2024-02-02', '2024-03-03', '2024-02-02'], [[4,5,6,4]], [map{"key3": 3, "key4": 4}], [row(2, "test2")]); --- result: -E: (1064, "Getting syntax error at line 1, column 1. Detail message: Unexpected input '3', the most similar input is {'SELECT', 'WITH', '('}.") --- !result -(1, [false, true, false], [20, NULL, 20], [200, 300, 200], [2000, 3000, 2000], [20000, 30000, 20000], [200000, 300000, 200000], [3.3, 4.4, 3.3], [4.4, 5.5, 4.4], ['world', 'hello', 'world', NULL], ['char2', 'char3', 'char2'], ['2024-02-02 13:00:00', '2024-03-03 14:00:00', '2024-02-02 13:00:00'], ['2024-02-02', '2024-03-03', '2024-02-02', NULL], [[4,5,6,4]], [map{"key3": 3, "key4": 4}], [row(2, "test2")]); --- result: -E: (1064, "Getting syntax error at line 1, column 1. Detail message: Unexpected input '1', the most similar input is {'SELECT', 'WITH', '('}.") --- !result -(2, [false, NULL, false], [20, 30, 20], [200, NULL, 200], [2000, 3000, NULL], [20000, 30000, 20000], [200000, 300000, NULL], [3.3, 4.4, 3.3, NULL], [4.4, 5.5, 4.4], ['world', 'hello', 'world'], [NULL, 'char2', 'char3', 'char2'], ['2024-02-02 13:00:00', '2024-03-03 14:00:00', '2024-02-02 13:00:00', NULL], ['2024-02-02', '2024-03-03', '2024-02-02'], [[4,5,6,4]], [map{"key3": 3, "key4": 4}], [row(2, "test2")]); --- result: -E: (1064, "Getting syntax error at line 1, column 1. Detail message: Unexpected input '2', the most similar input is {'SELECT', 'WITH', '('}.") --- !result -(3, [false, true, false], [20, 30, 20], [200, 300, 200], [2000, 3000, 2000], [20000, 30000, NULL], [200000, 300000, 200000], [3.3, 4.4, 3.3], [4.4, 5.5, 4.4, NULL], ['world', 'hello', 'world'], ['char2', 'char3', 'char2'], ['2024-02-02 13:00:00', '2024-03-03 14:00:00', '2024-02-02 13:00:00'], ['2024-02-02', '2024-03-03', '2024-02-02'], [[4,5,6,4]], [map{"key3": 3, "key4": 4}], [row(2, "test2")]); --- result: -E: (1064, "Getting syntax error at line 1, column 1. Detail message: Unexpected input '3', the most similar input is {'SELECT', 'WITH', '('}.") --- !result +(2, [false, true, false], [20, 30, 20], [200, 300, 200], [2000, 3000, 2000], [20000, 30000, 20000], [200000, 300000, 200000], [3.3, 4.4, 3.3], [4.4, 5.5, 4.4], ['world', 'hello', 'world'], ['char2', 'char3', 'char2'], ['2024-02-02 13:00:00', '2024-03-03 14:00:00', '2024-02-02 13:00:00'], ['2024-02-02', '2024-03-03', '2024-02-02'], [[4,5,6,4]], [map{"key3": 3, "key4": 4}], [row(2, "test2")]), +(3, [false, true, false], [20, 30, 20], [200, 300, 200], [2000, 3000, 2000], [20000, 30000, 20000], [200000, 300000, 200000], [3.3, 4.4, 3.3], [4.4, 5.5, 4.4], ['world', 'hello', 'world'], ['char2', 'char3', 'char2'], ['2024-02-02 13:00:00', '2024-03-03 14:00:00', '2024-02-02 13:00:00'], ['2024-02-02', '2024-03-03', '2024-02-02'], [[4,5,6,4]], [map{"key3": 3, "key4": 4}], [row(2, "test2")]), +(1, [false, true, false], [20, NULL, 20], [200, 300, 200], [2000, 3000, 2000], [20000, 30000, 20000], [200000, 300000, 200000], [3.3, 4.4, 3.3], [4.4, 5.5, 4.4], ['world', 'hello', 'world', NULL], ['char2', 'char3', 'char2'], ['2024-02-02 13:00:00', '2024-03-03 14:00:00', '2024-02-02 13:00:00'], ['2024-02-02', '2024-03-03', '2024-02-02', NULL], [[4,5,6,4]], [map{"key3": 3, "key4": 4}], [row(2, "test2")]), +(2, [false, NULL, false], [20, 30, 20], [200, NULL, 200], [2000, 3000, NULL], [20000, 30000, 20000], [200000, 300000, NULL], [3.3, 4.4, 3.3, NULL], [4.4, 5.5, 4.4], ['world', 'hello', 'world'], [NULL, 'char2', 'char3', 'char2'], ['2024-02-02 13:00:00', '2024-03-03 14:00:00', '2024-02-02 13:00:00', NULL], ['2024-02-02', '2024-03-03', '2024-02-02'], [[4,5,6,4]], [map{"key3": 3, "key4": 4}], [row(2, "test2")]), +(3, [false, true, false], [20, 30, 20], [200, 300, 200], [2000, 3000, 2000], [20000, 30000, NULL], [200000, 300000, 200000], [3.3, 4.4, 3.3], [4.4, 5.5, 4.4, NULL], ['world', 'hello', 'world'], ['char2', 'char3', 'char2'], ['2024-02-02 13:00:00', '2024-03-03 14:00:00', '2024-02-02 13:00:00'], ['2024-02-02', '2024-03-03', '2024-02-02'], [[4,5,6,4]], [map{"key3": 3, "key4": 4}], [row(2, "test2")]), (3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); -- result: -E: (1064, "Getting syntax error at line 1, column 1. Detail message: Unexpected input '3', the most similar input is {'SELECT', 'WITH', '('}.") -- !result SELECT id, ARRAY_MIN(ARRAY_UNIQUE_AGG(col_boolean)), ARRAY_MAX(ARRAY_UNIQUE_AGG(col_boolean)) FROM test_array_agg GROUP BY id ORDER BY id; -- result: 1 0 1 2 0 1 +3 0 1 -- !result SELECT id, ARRAY_MIN(ARRAY_UNIQUE_AGG(col_tinyint)), ARRAY_MAX(ARRAY_UNIQUE_AGG(col_tinyint)) FROM test_array_agg GROUP BY id ORDER BY id; -- result: 1 10 20 2 20 30 +3 20 30 -- !result SELECT id, ARRAY_MIN(ARRAY_UNIQUE_AGG(col_smallint)), ARRAY_MAX(ARRAY_UNIQUE_AGG(col_smallint)) FROM test_array_agg GROUP BY id ORDER BY id; -- result: -1 100 200 +1 100 300 2 200 300 +3 200 300 -- !result SELECT id, ARRAY_MIN(ARRAY_UNIQUE_AGG(col_int)), ARRAY_MAX(ARRAY_UNIQUE_AGG(col_int)) FROM test_array_agg GROUP BY id ORDER BY id; -- result: -1 1000 2000 +1 1000 3000 2 2000 3000 +3 2000 3000 -- !result SELECT id, ARRAY_MIN(ARRAY_UNIQUE_AGG(col_bigint)), ARRAY_MAX(ARRAY_UNIQUE_AGG(col_bigint)) FROM test_array_agg GROUP BY id ORDER BY id; -- result: -1 10000 20000 +1 10000 30000 2 20000 30000 +3 20000 30000 -- !result SELECT id, ARRAY_MIN(ARRAY_UNIQUE_AGG(col_largeint)), ARRAY_MAX(ARRAY_UNIQUE_AGG(col_largeint)) FROM test_array_agg GROUP BY id ORDER BY id; -- result: -1 100000 200000 +1 100000 300000 2 200000 300000 +3 200000 300000 -- !result SELECT id, ARRAY_MIN(ARRAY_UNIQUE_AGG(col_float)), ARRAY_MAX(ARRAY_UNIQUE_AGG(col_float)) FROM test_array_agg GROUP BY id ORDER BY id; -- result: -1 1.1 2.2 +1 1.1 4.4 2 3.3 4.4 +3 3.3 4.4 -- !result SELECT id, ARRAY_MIN(ARRAY_UNIQUE_AGG(col_double)), ARRAY_MAX(ARRAY_UNIQUE_AGG(col_double)) FROM test_array_agg GROUP BY id ORDER BY id; -- result: -1 2.2 3.3 +1 2.2 5.5 2 4.4 5.5 +3 4.4 5.5 -- !result SELECT id, ARRAY_MIN(ARRAY_UNIQUE_AGG(col_varchar)), ARRAY_MAX(ARRAY_UNIQUE_AGG(col_varchar)) FROM test_array_agg GROUP BY id ORDER BY id; -- result: 1 hello world 2 hello world +3 hello world -- !result SELECT id, ARRAY_MIN(ARRAY_UNIQUE_AGG(col_char)), ARRAY_MAX(ARRAY_UNIQUE_AGG(col_char)) FROM test_array_agg GROUP BY id ORDER BY id; -- result: -1 char1 char2 +1 char1 char3 2 char2 char3 +3 char2 char3 -- !result SELECT id, ARRAY_MIN(ARRAY_UNIQUE_AGG(col_datetime)), ARRAY_MAX(ARRAY_UNIQUE_AGG(col_datetime)) FROM test_array_agg GROUP BY id ORDER BY id; -- result: -1 2024-01-01 12:00:00 2024-02-02 13:00:00 +1 2024-01-01 12:00:00 2024-03-03 14:00:00 2 2024-02-02 13:00:00 2024-03-03 14:00:00 +3 2024-02-02 13:00:00 2024-03-03 14:00:00 -- !result SELECT id, ARRAY_MIN(ARRAY_UNIQUE_AGG(col_date)), ARRAY_MAX(ARRAY_UNIQUE_AGG(col_date)) FROM test_array_agg GROUP BY id ORDER BY id; -- result: -1 2024-01-01 2024-02-02 +1 2024-01-01 2024-03-03 2 2024-02-02 2024-03-03 +3 2024-02-02 2024-03-03 -- !result \ No newline at end of file diff --git a/test/sql/test_agg_function/T/test_array_unique_agg b/test/sql/test_agg_function/T/test_array_unique_agg index 208fdc9a315642..64c4e2a55f88da 100644 --- a/test/sql/test_agg_function/T/test_array_unique_agg +++ b/test/sql/test_agg_function/T/test_array_unique_agg @@ -50,11 +50,11 @@ PROPERTIES ("replication_num" = "1"); insert into test_array_agg values (1, [true, false, true], [10, 20, 10], [100, 200, 100], [1000, 2000, 1000], [10000, 20000, 10000], [100000, 200000, 100000], [1.1, 2.2, 1.1], [2.2, 3.3, 2.2], ['hello', 'world', 'hello'], ['char1', 'char2', 'char1'], ['2024-01-01 12:00:00', '2024-02-02 13:00:00', '2024-01-01 12:00:00'], ['2024-01-01', '2024-02-02', '2024-01-01'], [[1,2,3,1]], [map{"key1": 1, "key2": 2}], [row(1, "test1")]), -(2, [false, true, false], [20, 30, 20], [200, 300, 200], [2000, 3000, 2000], [20000, 30000, 20000], [200000, 300000, 200000], [3.3, 4.4, 3.3], [4.4, 5.5, 4.4], ['world', 'hello', 'world'], ['char2', 'char3', 'char2'], ['2024-02-02 13:00:00', '2024-03-03 14:00:00', '2024-02-02 13:00:00'], ['2024-02-02', '2024-03-03', '2024-02-02'], [[4,5,6,4]], [map{"key3": 3, "key4": 4}], [row(2, "test2")]); -(3, [false, true, false], [20, 30, 20], [200, 300, 200], [2000, 3000, 2000], [20000, 30000, 20000], [200000, 300000, 200000], [3.3, 4.4, 3.3], [4.4, 5.5, 4.4], ['world', 'hello', 'world'], ['char2', 'char3', 'char2'], ['2024-02-02 13:00:00', '2024-03-03 14:00:00', '2024-02-02 13:00:00'], ['2024-02-02', '2024-03-03', '2024-02-02'], [[4,5,6,4]], [map{"key3": 3, "key4": 4}], [row(2, "test2")]); -(1, [false, true, false], [20, NULL, 20], [200, 300, 200], [2000, 3000, 2000], [20000, 30000, 20000], [200000, 300000, 200000], [3.3, 4.4, 3.3], [4.4, 5.5, 4.4], ['world', 'hello', 'world', NULL], ['char2', 'char3', 'char2'], ['2024-02-02 13:00:00', '2024-03-03 14:00:00', '2024-02-02 13:00:00'], ['2024-02-02', '2024-03-03', '2024-02-02', NULL], [[4,5,6,4]], [map{"key3": 3, "key4": 4}], [row(2, "test2")]); -(2, [false, NULL, false], [20, 30, 20], [200, NULL, 200], [2000, 3000, NULL], [20000, 30000, 20000], [200000, 300000, NULL], [3.3, 4.4, 3.3, NULL], [4.4, 5.5, 4.4], ['world', 'hello', 'world'], [NULL, 'char2', 'char3', 'char2'], ['2024-02-02 13:00:00', '2024-03-03 14:00:00', '2024-02-02 13:00:00', NULL], ['2024-02-02', '2024-03-03', '2024-02-02'], [[4,5,6,4]], [map{"key3": 3, "key4": 4}], [row(2, "test2")]); -(3, [false, true, false], [20, 30, 20], [200, 300, 200], [2000, 3000, 2000], [20000, 30000, NULL], [200000, 300000, 200000], [3.3, 4.4, 3.3], [4.4, 5.5, 4.4, NULL], ['world', 'hello', 'world'], ['char2', 'char3', 'char2'], ['2024-02-02 13:00:00', '2024-03-03 14:00:00', '2024-02-02 13:00:00'], ['2024-02-02', '2024-03-03', '2024-02-02'], [[4,5,6,4]], [map{"key3": 3, "key4": 4}], [row(2, "test2")]); +(2, [false, true, false], [20, 30, 20], [200, 300, 200], [2000, 3000, 2000], [20000, 30000, 20000], [200000, 300000, 200000], [3.3, 4.4, 3.3], [4.4, 5.5, 4.4], ['world', 'hello', 'world'], ['char2', 'char3', 'char2'], ['2024-02-02 13:00:00', '2024-03-03 14:00:00', '2024-02-02 13:00:00'], ['2024-02-02', '2024-03-03', '2024-02-02'], [[4,5,6,4]], [map{"key3": 3, "key4": 4}], [row(2, "test2")]), +(3, [false, true, false], [20, 30, 20], [200, 300, 200], [2000, 3000, 2000], [20000, 30000, 20000], [200000, 300000, 200000], [3.3, 4.4, 3.3], [4.4, 5.5, 4.4], ['world', 'hello', 'world'], ['char2', 'char3', 'char2'], ['2024-02-02 13:00:00', '2024-03-03 14:00:00', '2024-02-02 13:00:00'], ['2024-02-02', '2024-03-03', '2024-02-02'], [[4,5,6,4]], [map{"key3": 3, "key4": 4}], [row(2, "test2")]), +(1, [false, true, false], [20, NULL, 20], [200, 300, 200], [2000, 3000, 2000], [20000, 30000, 20000], [200000, 300000, 200000], [3.3, 4.4, 3.3], [4.4, 5.5, 4.4], ['world', 'hello', 'world', NULL], ['char2', 'char3', 'char2'], ['2024-02-02 13:00:00', '2024-03-03 14:00:00', '2024-02-02 13:00:00'], ['2024-02-02', '2024-03-03', '2024-02-02', NULL], [[4,5,6,4]], [map{"key3": 3, "key4": 4}], [row(2, "test2")]), +(2, [false, NULL, false], [20, 30, 20], [200, NULL, 200], [2000, 3000, NULL], [20000, 30000, 20000], [200000, 300000, NULL], [3.3, 4.4, 3.3, NULL], [4.4, 5.5, 4.4], ['world', 'hello', 'world'], [NULL, 'char2', 'char3', 'char2'], ['2024-02-02 13:00:00', '2024-03-03 14:00:00', '2024-02-02 13:00:00', NULL], ['2024-02-02', '2024-03-03', '2024-02-02'], [[4,5,6,4]], [map{"key3": 3, "key4": 4}], [row(2, "test2")]), +(3, [false, true, false], [20, 30, 20], [200, 300, 200], [2000, 3000, 2000], [20000, 30000, NULL], [200000, 300000, 200000], [3.3, 4.4, 3.3], [4.4, 5.5, 4.4, NULL], ['world', 'hello', 'world'], ['char2', 'char3', 'char2'], ['2024-02-02 13:00:00', '2024-03-03 14:00:00', '2024-02-02 13:00:00'], ['2024-02-02', '2024-03-03', '2024-02-02'], [[4,5,6,4]], [map{"key3": 3, "key4": 4}], [row(2, "test2")]), (3, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); SELECT id, ARRAY_MIN(ARRAY_UNIQUE_AGG(col_boolean)), ARRAY_MAX(ARRAY_UNIQUE_AGG(col_boolean)) FROM test_array_agg GROUP BY id ORDER BY id;