From 9fb88b7600da6859c441085ef18978cd84a78d1d Mon Sep 17 00:00:00 2001 From: zhiqiang-hhhh Date: Mon, 23 Oct 2023 17:07:34 +0800 Subject: [PATCH 1/2] user case --- .../sql_functions/conditional_functions/test_if.out | 6 ++++++ .../sql_functions/conditional_functions/test_if.groovy | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/regression-test/data/query_p0/sql_functions/conditional_functions/test_if.out b/regression-test/data/query_p0/sql_functions/conditional_functions/test_if.out index 832f69157d4907..46bb3cdd006bda 100644 --- a/regression-test/data/query_p0/sql_functions/conditional_functions/test_if.out +++ b/regression-test/data/query_p0/sql_functions/conditional_functions/test_if.out @@ -11,3 +11,9 @@ -- !select -- [] +-- !select -- +true 1 + +-- !select -- +true + diff --git a/regression-test/suites/query_p0/sql_functions/conditional_functions/test_if.groovy b/regression-test/suites/query_p0/sql_functions/conditional_functions/test_if.groovy index 9a99e8bbd94013..55b82e940f465c 100644 --- a/regression-test/suites/query_p0/sql_functions/conditional_functions/test_if.groovy +++ b/regression-test/suites/query_p0/sql_functions/conditional_functions/test_if.groovy @@ -21,4 +21,8 @@ suite("test_if") { qt_select "select if(job_d is null, array(), job_d) as test from (select array('1970-01-01', '1970-01-01') as job_d) t" qt_select "select if(job_d is null, array('1970-01-01'), job_d) as test from (select array('1970-01-01', '1970-01-01') as job_d) t" qt_select "select if(job_d is null, job_d, array()) as test from (select array('1970-01-01', '1970-01-01') as job_d) t" + + // user case https://github.com/apache/doris/issues/25644 + qt_select "SELECT NOT ISNULL(CASE WHEN IFNULL ((t1.region IN ('US')),0) THEN t1.region ELSE 'other' END) AS account_id, count(*) FROM (select 'US' AS region) as t1 group by 1" + qt_select "SELECT NOT ISNULL(CASE WHEN IFNULL (('US' IN ('US')),0) THEN 'US' ELSE 'other' END);" } From e5fb79daa639ff84a6cdddb855c5cd30506fc51d Mon Sep 17 00:00:00 2001 From: zhiqiang-hhhh Date: Mon, 23 Oct 2023 17:14:07 +0800 Subject: [PATCH 2/2] n --- .../sql_functions/conditional_functions/test_if.out | 5 +++++ .../sql_functions/conditional_functions/test_if.groovy | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/regression-test/data/query_p0/sql_functions/conditional_functions/test_if.out b/regression-test/data/query_p0/sql_functions/conditional_functions/test_if.out index 46bb3cdd006bda..d5ceb465b232be 100644 --- a/regression-test/data/query_p0/sql_functions/conditional_functions/test_if.out +++ b/regression-test/data/query_p0/sql_functions/conditional_functions/test_if.out @@ -17,3 +17,8 @@ true 1 -- !select -- true +-- !select -- +true 1 + +-- !select -- +true diff --git a/regression-test/suites/query_p0/sql_functions/conditional_functions/test_if.groovy b/regression-test/suites/query_p0/sql_functions/conditional_functions/test_if.groovy index 55b82e940f465c..ba0363f4197b2c 100644 --- a/regression-test/suites/query_p0/sql_functions/conditional_functions/test_if.groovy +++ b/regression-test/suites/query_p0/sql_functions/conditional_functions/test_if.groovy @@ -23,6 +23,9 @@ suite("test_if") { qt_select "select if(job_d is null, job_d, array()) as test from (select array('1970-01-01', '1970-01-01') as job_d) t" // user case https://github.com/apache/doris/issues/25644 - qt_select "SELECT NOT ISNULL(CASE WHEN IFNULL ((t1.region IN ('US')),0) THEN t1.region ELSE 'other' END) AS account_id, count(*) FROM (select 'US' AS region) as t1 group by 1" - qt_select "SELECT NOT ISNULL(CASE WHEN IFNULL (('US' IN ('US')),0) THEN 'US' ELSE 'other' END);" + qt_select "SELECT /*+SET_VAR(enable_nereids_planner=true)*/ NOT ISNULL(CASE WHEN IFNULL ((t1.region IN ('US')),0) THEN t1.region ELSE 'other' END) AS account_id, count(*) FROM (select 'US' AS region) as t1 group by 1" + qt_select "SELECT /*+SET_VAR(enable_nereids_planner=true)*/ NOT ISNULL(CASE WHEN IFNULL (('US' IN ('US')),0) THEN 'US' ELSE 'other' END);" + + qt_select "SELECT /*+SET_VAR(enable_nereids_planner=false)*/ NOT ISNULL(CASE WHEN IFNULL ((t1.region IN ('US')),0) THEN t1.region ELSE 'other' END) AS account_id, count(*) FROM (select 'US' AS region) as t1 group by 1" + qt_select "SELECT /*+SET_VAR(enable_nereids_planner=false)*/ NOT ISNULL(CASE WHEN IFNULL (('US' IN ('US')),0) THEN 'US' ELSE 'other' END);" }