squash! added a stateless test to check if an analyser bug described in https://github.com/ClickHouse/ClickHouse/issues/66333 is still happening

This commit is contained in:
maxvostrikov 2024-07-12 12:27:35 +02:00
parent e0486436d8
commit 2e0f553ce7
2 changed files with 11 additions and 30 deletions

View File

@ -1,4 +1,4 @@
this query used to be broken in old analyser:
c1 c2 yes true 1
c1 c2 yes true
this query worked:
c1 c2 yes true 1
yes true

View File

@ -6,37 +6,18 @@ AS SELECT
'c2' as column_b;
select 'this query used to be broken in old analyser:';
SELECT
*,
multiIf(column_b IN (
SELECT 'c2' as someproduct
), 'yes', 'no') AS condition_1,
multiIf(column_b = 'c2', 'true', 'false') AS condition_2,
--condition in WHERE is true
(condition_1 IN ('yes')) AND (condition_2 in ('true')) as cond
FROM
(
SELECT column_a, column_b
FROM bugcheck1
)
SELECT *,
multiIf(column_b IN (SELECT 'c2' as someproduct), 'yes', 'no') AS condition_1,
multiIf(column_b = 'c2', 'true', 'false') AS condition_2
FROM (SELECT column_a, column_b FROM bugcheck1)
WHERE (condition_1 IN ('yes')) AND (condition_2 in ('true'))
settings allow_experimental_analyzer=0;
select 'this query worked:';
SELECT
*,
multiIf(column_b IN (
SELECT 'c2' as someproduct
), 'yes', 'no') AS condition_1,
multiIf(column_b = 'c2', 'true', 'false') AS condition_2,
--condition in WHERE is true
(condition_1 IN ('yes')) AND (condition_2 in ('true')) as cond
FROM
(
SELECT column_a, column_b
FROM bugcheck1
)
--the next line is the only difference:
-- WHERE (condition_1 IN ('yes')) AND (condition_2 in ('true'))
WHERE (condition_2 in ('true'))
multiIf(column_b IN (SELECT 'c2' as someproduct), 'yes', 'no') AS condition_1,
multiIf(column_b = 'c2', 'true', 'false') AS condition_2
FROM (SELECT column_a, column_b FROM bugcheck1)
WHERE (condition_1 IN ('yes')) AND (condition_2 in ('true'))
settings allow_experimental_analyzer=0;