This is an automated email from the ASF dual-hosted git repository. lide 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 bb9d532e653 [fix](planner) fix no data issue when use datetimev1/datatimev2 & datev2 as function coalesce's parameter in legacy planner (#36583) bb9d532e653 is described below commit bb9d532e653a131e7a3883062f1bfb9ab382623a Author: Yulei-Yang <yulei.yang0...@gmail.com> AuthorDate: Thu Jun 20 15:22:54 2024 +0800 [fix](planner) fix no data issue when use datetimev1/datatimev2 & datev2 as function coalesce's parameter in legacy planner (#36583) --- gensrc/script/doris_builtins_functions.py | 2 + .../conditional_functions/test_coalesce_new.groovy | 101 +++++++++++++++++++++ 2 files changed, 103 insertions(+) diff --git a/gensrc/script/doris_builtins_functions.py b/gensrc/script/doris_builtins_functions.py index 9fa38174be1..ea09c5473c1 100644 --- a/gensrc/script/doris_builtins_functions.py +++ b/gensrc/script/doris_builtins_functions.py @@ -1452,8 +1452,10 @@ visible_functions = { [['coalesce'], 'FLOAT', ['FLOAT', '...'], 'CUSTOM'], [['coalesce'], 'DOUBLE', ['DOUBLE', '...'], 'CUSTOM'], [['coalesce'], 'DATETIME', ['DATETIME', '...'], 'CUSTOM'], + [['coalesce'], 'DATETIMEV2', ['DATETIME', 'DATEV2', '...'], 'CUSTOM'], [['coalesce'], 'DATE', ['DATE', '...'], 'CUSTOM'], [['coalesce'], 'DATETIMEV2', ['DATETIMEV2', '...'], 'CUSTOM'], + [['coalesce'], 'DATETIMEV2', ['DATETIMEV2', 'DATEV2', '...'], 'CUSTOM'], [['coalesce'], 'DATEV2', ['DATEV2', '...'], 'CUSTOM'], [['coalesce'], 'DECIMALV2', ['DECIMALV2', '...'], 'CUSTOM'], [['coalesce'], 'DECIMAL32', ['DECIMAL32', '...'], 'CUSTOM'], diff --git a/regression-test/suites/query_p0/sql_functions/conditional_functions/test_coalesce_new.groovy b/regression-test/suites/query_p0/sql_functions/conditional_functions/test_coalesce_new.groovy new file mode 100644 index 00000000000..194849a3c63 --- /dev/null +++ b/regression-test/suites/query_p0/sql_functions/conditional_functions/test_coalesce_new.groovy @@ -0,0 +1,101 @@ +// 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_coalesce_new") { + // test parameter:datetime, datev2 + sql """ + admin set frontend config ("enable_date_conversion"="false") + """ + sql """ + admin set frontend config ("disable_datev1"="false") + """ + sql """ + drop table if exists test_cls + """ + + sql """ + CREATE TABLE `test_cls` ( + `id` int(11) NOT NULL COMMENT '', + `name` varchar(32) NOT NULL COMMENT '', + `dt` datetime NOT NULL + ) ENGINE=OLAP + UNIQUE KEY(`id`) + DISTRIBUTED BY HASH(`id`) BUCKETS 2 + PROPERTIES( + "replication_allocation" = "tag.location.default: 1" + ); + """ + + sql """ + insert into test_cls values (1,'Alice','2023-06-01 12:00:00'),(2,'Bob','2023-06-02 12:00:00'),(3,'Carl','2023-05-01 14:00:00') + """ + + sql """ + SET enable_nereids_planner=false + """ + def result1 = try_sql """ + select dt from test_cls where coalesce (dt, str_to_date(concat('202306', '01'), '%Y%m%d')) >= '2023-06-01' + """ + assertEquals(result1.size(), 2); + + + // test parameter:datetimev2, datev2 + sql """ + admin set frontend config ("enable_date_conversion"="true") + """ + sql """ + admin set frontend config ("disable_datev1"="true") + """ + sql """ + drop table if exists test_cls_dtv2 + """ + + sql """ + CREATE TABLE `test_cls_dtv2` ( + `id` int(11) NOT NULL COMMENT '', + `name` varchar(32) NOT NULL COMMENT '', + `dt` datetime NOT NULL + ) ENGINE=OLAP + UNIQUE KEY(`id`) + DISTRIBUTED BY HASH(`id`) BUCKETS 2 + PROPERTIES( + "replication_allocation" = "tag.location.default: 1" + ); + """ + + sql """ + insert into test_cls_dtv2 values (1,'Alice','2023-06-01 12:00:00'),(2,'Bob','2023-06-02 12:00:00'),(3,'Carl','2023-05-01 14:00:00') + """ + + sql """ + SET enable_nereids_planner=false + """ + def result2 = try_sql """ + select dt from test_cls_dtv2 where coalesce (dt, str_to_date(concat('202306', '01'), '%Y%m%d')) >= '2023-06-01' + """ + assertEquals(result2.size(), 2); + + sql """ + drop table test_cls + """ + sql """ + drop table test_cls_dtv2 + """ + sql """ + admin set frontend config ("disable_datev1"="false") + """ +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org