From 1cc701af4492878dd3b6e6df91cb50de7bd4dce4 Mon Sep 17 00:00:00 2001 From: Denny Crane Date: Wed, 21 Feb 2024 17:56:09 -0400 Subject: [PATCH 1/2] test for #60223 --- .../02983_empty_map_hasToken.reference | 10 +++++++ .../0_stateless/02983_empty_map_hasToken.sql | 27 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 tests/queries/0_stateless/02983_empty_map_hasToken.reference create mode 100644 tests/queries/0_stateless/02983_empty_map_hasToken.sql diff --git a/tests/queries/0_stateless/02983_empty_map_hasToken.reference b/tests/queries/0_stateless/02983_empty_map_hasToken.reference new file mode 100644 index 00000000000..75378377541 --- /dev/null +++ b/tests/queries/0_stateless/02983_empty_map_hasToken.reference @@ -0,0 +1,10 @@ +2 +2 +2 +2 +2 +2 +2 +2 +2 +2 diff --git a/tests/queries/0_stateless/02983_empty_map_hasToken.sql b/tests/queries/0_stateless/02983_empty_map_hasToken.sql new file mode 100644 index 00000000000..c983262720c --- /dev/null +++ b/tests/queries/0_stateless/02983_empty_map_hasToken.sql @@ -0,0 +1,27 @@ +-- https://github.com/ClickHouse/ClickHouse/issues/60223 + +CREATE TABLE test +( + t String, + id String, + h Map(String, String) +) +ENGINE = MergeTree +ORDER BY (t, id) SETTINGS index_granularity = 4096 ; + +insert into test values ('xxx', 'x', {'content-type':'text/plain','user-agent':'bulk-tests'}); +insert into test values ('xxx', 'y', {'content-type':'application/json','user-agent':'bulk-tests'}); +insert into test select 'xxx', number, map('content-type', 'x' ) from numbers(1e2); + +optimize table test final; + +SELECT count() FROM test PREWHERE hasToken(h['user-agent'], 'bulk') WHERE hasToken(h['user-agent'], 'tests') and t = 'xxx'; +SELECT count() FROM test PREWHERE hasToken(h['user-agent'], 'tests') WHERE hasToken(h['user-agent'], 'bulk') and t = 'xxx'; +SELECT count() FROM test WHERE hasToken(h['user-agent'], 'bulk') and hasToken(h['user-agent'], 'tests') and t = 'xxx'; +SELECT count() FROM test PREWHERE hasToken(h['user-agent'], 'bulk') and hasToken(h['user-agent'], 'tests') and t = 'xxx'; +SELECT count() FROM test PREWHERE hasToken(h['user-agent'], 'bulk') and hasToken(h['user-agent'], 'tests') WHERE t = 'xxx'; +SELECT count() FROM test PREWHERE hasToken(h['user-agent'], 'tests') and hasToken(h['user-agent'], 'bulk') WHERE t = 'xxx'; +SELECT count() FROM test PREWHERE hasToken(h['user-agent'], 'tests') and hasToken(h['user-agent'], 'bulk'); +SELECT count() FROM test PREWHERE hasToken(h['user-agent'], 'bulk') and hasToken(h['user-agent'], 'tests'); +SELECT count() FROM test WHERE hasToken(h['user-agent'], 'tests') and hasToken(h['user-agent'], 'bulk'); +SELECT count() FROM test WHERE hasToken(h['user-agent'], 'bulk') and hasToken(h['user-agent'], 'tests'); From 7ed31df6b8b461608a6349ec7a3f03b258227a06 Mon Sep 17 00:00:00 2001 From: Yarik Briukhovetskyi <114298166+yariks5s@users.noreply.github.com> Date: Tue, 27 Feb 2024 13:56:16 +0100 Subject: [PATCH 2/2] reload ci --- tests/queries/0_stateless/02983_empty_map_hasToken.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/queries/0_stateless/02983_empty_map_hasToken.sql b/tests/queries/0_stateless/02983_empty_map_hasToken.sql index c983262720c..6d146150ac8 100644 --- a/tests/queries/0_stateless/02983_empty_map_hasToken.sql +++ b/tests/queries/0_stateless/02983_empty_map_hasToken.sql @@ -11,7 +11,7 @@ ORDER BY (t, id) SETTINGS index_granularity = 4096 ; insert into test values ('xxx', 'x', {'content-type':'text/plain','user-agent':'bulk-tests'}); insert into test values ('xxx', 'y', {'content-type':'application/json','user-agent':'bulk-tests'}); -insert into test select 'xxx', number, map('content-type', 'x' ) from numbers(1e2); +insert into test select 'xxx', number, map('content-type', 'x' ) FROM numbers(1e2); optimize table test final;