This is an automated email from the ASF dual-hosted git repository. panxiaolei pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new 6bebf92254 [fix][FE] fix be coredump when children of FunctionCallExpr is folded (#16064) 6bebf92254 is described below commit 6bebf9225454ef6bcbaccca48fe111e92e3f3a11 Author: shee <13843187+qz...@users.noreply.github.com> AuthorDate: Mon Jan 30 15:25:00 2023 +0800 [fix][FE] fix be coredump when children of FunctionCallExpr is folded (#16064) Co-authored-by: shizhiqiang03 <shizhiqian...@meituan.com> fix be coredump when children of FunctionCallExpr is folded --- .../mvrewrite/CountDistinctToBitmapOrHLLRule.java | 2 +- .../test_count_distinct_with_case_function.out | 3 ++ .../test_count_distinct_with_case_function.groovy | 58 ++++++++++++++++++++++ 3 files changed, 62 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/rewrite/mvrewrite/CountDistinctToBitmapOrHLLRule.java b/fe/fe-core/src/main/java/org/apache/doris/rewrite/mvrewrite/CountDistinctToBitmapOrHLLRule.java index e9e4795c31..b27169b448 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/rewrite/mvrewrite/CountDistinctToBitmapOrHLLRule.java +++ b/fe/fe-core/src/main/java/org/apache/doris/rewrite/mvrewrite/CountDistinctToBitmapOrHLLRule.java @@ -58,7 +58,7 @@ public class CountDistinctToBitmapOrHLLRule implements ExprRewriteRule { return expr; } // rewrite expr - FunctionParams newParams = new FunctionParams(false, fnExpr.getParams().exprs()); + FunctionParams newParams = new FunctionParams(false, fnExpr.getChildren()); if (fnExpr.getChild(0).getType().isBitmapType()) { FunctionCallExpr bitmapExpr = new FunctionCallExpr(FunctionSet.BITMAP_UNION_COUNT, newParams); bitmapExpr.analyzeNoThrow(analyzer); diff --git a/regression-test/data/query_p0/sql_functions/case_function/test_count_distinct_with_case_function.out b/regression-test/data/query_p0/sql_functions/case_function/test_count_distinct_with_case_function.out new file mode 100644 index 0000000000..b3a2b05813 --- /dev/null +++ b/regression-test/data/query_p0/sql_functions/case_function/test_count_distinct_with_case_function.out @@ -0,0 +1,3 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !select -- +2 diff --git a/regression-test/suites/query_p0/sql_functions/case_function/test_count_distinct_with_case_function.groovy b/regression-test/suites/query_p0/sql_functions/case_function/test_count_distinct_with_case_function.groovy new file mode 100644 index 0000000000..87c8369ab8 --- /dev/null +++ b/regression-test/suites/query_p0/sql_functions/case_function/test_count_distinct_with_case_function.groovy @@ -0,0 +1,58 @@ +// 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_count_distinct_with_case_function") { + sql "DROP DATABASE IF EXISTS test_count_distinct_with_case_function" + + sql "CREATE DATABASE test_count_distinct_with_case_function" + + sql "USE test_count_distinct_with_case_function" + + sql """ + CREATE TABLE `a` ( + `k1` int(11) NULL COMMENT "", + `k2` bitmap BITMAP_UNION NULL COMMENT "", + `k3` bitmap BITMAP_UNION NULL COMMENT "" + ) ENGINE=OLAP + AGGREGATE KEY(`k1`) + DISTRIBUTED BY HASH(`k1`) BUCKETS 10 + PROPERTIES ( + "replication_num" = "1", + "in_memory" = "false", + "storage_format" = "V2" + ); + """ + + sql """ + CREATE TABLE `b` ( + `k1` int(11) NULL COMMENT "" + ) ENGINE=OLAP + DUPLICATE KEY(`k1`) + DISTRIBUTED BY HASH(`k1`) BUCKETS 10 + PROPERTIES ( + "replication_num" = "1", + "in_memory" = "false", + "storage_format" = "V2" + ); + """ + sql "insert into a values(1,to_bitmap(1),to_bitmap(1));" + sql "insert into a values(1,to_bitmap(1),to_bitmap(2));" + sql "insert into a values(2,to_bitmap(1),to_bitmap(1));" + sql "insert into b values(1);" + + qt_select "select count(distinct case when false then k2 when true then k3 end) as tmp from a where k1 in (select k1 from b group by k1);" +} --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org