You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2022/07/30 02:24:54 UTC
[doris] branch master updated: [Bug][Function] core dump on sum(distinct) (#11308)
This is an automated email from the ASF dual-hosted git repository.
yiguolei 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 532395c6a0 [Bug][Function] core dump on sum(distinct) (#11308)
532395c6a0 is described below
commit 532395c6a005183db19e86bdfdf4f8591453cb86
Author: Pxl <95...@qq.com>
AuthorDate: Sat Jul 30 10:24:48 2022 +0800
[Bug][Function] core dump on sum(distinct) (#11308)
* fix align size calculate for distinct combinator
---
.../aggregate_function_distinct.h | 8 +-
.../test_aggregate_all_functions.out | 174 +++++++++++++--------
.../test_aggregate_all_functions.groovy | 6 +-
3 files changed, 120 insertions(+), 68 deletions(-)
diff --git a/be/src/vec/aggregate_functions/aggregate_function_distinct.h b/be/src/vec/aggregate_functions/aggregate_function_distinct.h
index 820759a7ff..f37f3f3efa 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_distinct.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_distinct.h
@@ -154,7 +154,7 @@ template <typename Data>
class AggregateFunctionDistinct
: public IAggregateFunctionDataHelper<Data, AggregateFunctionDistinct<Data>> {
private:
- static constexpr auto prefix_size = sizeof(Data);
+ size_t prefix_size;
AggregateFunctionPtr nested_func;
size_t arguments_num;
@@ -171,7 +171,11 @@ public:
: IAggregateFunctionDataHelper<Data, AggregateFunctionDistinct>(
arguments, nested_func_->get_parameters()),
nested_func(nested_func_),
- arguments_num(arguments.size()) {}
+ arguments_num(arguments.size()) {
+ size_t nested_size = nested_func->align_of_data();
+ CHECK_GT(nested_size, 0);
+ prefix_size = (sizeof(Data) + nested_size - 1) / nested_size * nested_size;
+ }
void add(AggregateDataPtr __restrict place, const IColumn** columns, size_t row_num,
Arena* arena) const override {
diff --git a/regression-test/data/query/sql_functions/aggregate_functions/test_aggregate_all_functions.out b/regression-test/data/query/sql_functions/aggregate_functions/test_aggregate_all_functions.out
index bb6a1de556..6c25cf3d2a 100644
--- a/regression-test/data/query/sql_functions/aggregate_functions/test_aggregate_all_functions.out
+++ b/regression-test/data/query/sql_functions/aggregate_functions/test_aggregate_all_functions.out
@@ -2,165 +2,211 @@
-- !select1 --
1
2
+
-- !select2 --
-beijing 100
-xian 100
+beijing 100.0
+xian 100.0
+
-- !select3 --
-beijing 100
-xian 100
+beijing 100.0
+xian 100.0
+
-- !select4 --
3
+
-- !select5 --
3
+
-- !select6 --
beijing 3
xian 3
+
-- !select7 --
beijing 3
xian 3
+
-- !select8 --
beijing 3
xian 2
+
-- !select9 --
beijing, xian, beijing, chengdu, shanghai
+
-- !select10 --
beijing xian beijing chengdu shanghai
+
-- !select11 --
-\\N
+\N
+
-- !select12 --
beijing, xian
beijing, chengdu, shanghai
+
-- !select13 --
beijing xian
beijing chengdu shanghai
+
-- !select14 --
-\\N
-\\N
+\N
+\N
+
-- !select15 --
1 1
2 1
4 1
5 1
6 1
+
-- !select16 --
1 10
2 441
3 10
5 29
6 101
+
-- !select17 --
441
+
-- !select18 --
1 10
2 8
3 10
5 29
6 101
+
-- !select19 --
8
+
-- !select20 --
-1 10
+1 10.0
2 224.5
-3 10
-5 29
-6 101
+3 10.0
+5 29.0
+6 101.0
+
-- !select21 --
-1 10
+1 10.0
2 246.15
-3 10
-5 29
-6 101
+3 10.0
+5 29.0
+6 101.0
+
-- !select22 --
-1 10
+1 10.0
2 356.565
-3 10
-5 29
-6 101
+3 10.0
+5 29.0
+6 101.0
+
-- !select23 --
-1 10
+1 10.0
2 224.5
-3 10
-5 29
-6 101
+3 10.0
+5 29.0
+6 101.0
+
-- !select24 --
-1 10
-2 267.80001831054688
-3 10
-5 29
-6 101
+1 10.0
+2 267.8000183105469
+3 10.0
+5 29.0
+6 101.0
+
-- !select25 --
-1 10
-2 441
-3 10
-5 29
-6 101
+1 10.0
+2 441.0
+3 10.0
+5 29.0
+6 101.0
+
-- !select26 --
-1 10
+1 10.0
2 224.5
-3 10
-5 29
-6 101
+3 10.0
+5 29.0
+6 101.0
+
-- !select27 --
-1 10
-2 267.80001831054688
-3 10
-5 29
-6 101
+1 10.0
+2 267.8000183105469
+3 10.0
+5 29.0
+6 101.0
+
-- !select28 --
-1 10
-2 441
-3 10
-5 29
-6 101
+1 10.0
+2 441.0
+3 10.0
+5 29.0
+6 101.0
+
-- !select29 --
-1 0
+1 0.0
2 216.5
-3 36
+3 36.0
+
-- !select30 --
-1 0
+1 0.0
2 216.5
-3 36
+3 36.0
+
-- !select31 --
-1 0
-2 306.17723625377511
-3 50.911688245431421
+1 0.0
+2 306.1772362537751
+3 50.91168824543142
+
-- !select32 --
1 20
2 449
3 130
+
-- !select33 --
599
+
-- !select34 --
1 {"10":2,"13":1}
2 {"18":2,"441":1}
3 {"4":1,"29":1}
+
-- !select35 --
1 {"10":2,"13":1}
2 {"18":2,"441":1}
3 {"4":1,"29":1}
+
-- !select36 --
{"18":2,"10":2}
+
-- !select37 --
-1 0
+1 0.0
2 93744.5
-3 2592
+3 2592.0
+
-- !select38 --
-1 0
+1 0.0
2 93744.5
-3 2592
+3 2592.0
+
-- !select39 --
-1 0
+1 0.0
2 46872.25
-3 1296
+3 1296.0
+
-- !select40 --
-1 0
+1 0.0
2 46872.25
-3 1296
+3 1296.0
+
-- !select41 --
-1 0
+1 0.0
2 46872.25
-3 1296
+3 1296.0
+
-- !select42 --
2
+
-- !select43 --
2
+
+-- !select44 --
+6 3975 2003 33035710 25819.948 78965.368 4449.5830001831055
+
diff --git a/regression-test/suites/query/sql_functions/aggregate_functions/test_aggregate_all_functions.groovy b/regression-test/suites/query/sql_functions/aggregate_functions/test_aggregate_all_functions.groovy
index 551d2bfcbf..ddf7337e5b 100644
--- a/regression-test/suites/query/sql_functions/aggregate_functions/test_aggregate_all_functions.groovy
+++ b/regression-test/suites/query/sql_functions/aggregate_functions/test_aggregate_all_functions.groovy
@@ -392,8 +392,8 @@ suite("test_aggregate_all_functions", "query") {
"""
sql "INSERT INTO ${tableName_19} values(1,10), (2,8), (2,441) ,(1,10) ,(3,29) ,(3,101)"
- qt_select37 = sql "select id,var_samp(level) from ${tableName_19} group by id order by id"
- qt_select38 = sql "select id,variance_samp(level) from ${tableName_19} group by id order by id"
+ qt_select37 "select id,var_samp(level) from ${tableName_19} group by id order by id"
+ qt_select38 "select id,variance_samp(level) from ${tableName_19} group by id order by id"
sql "DROP TABLE IF EXISTS ${tableName_19}"
@@ -460,4 +460,6 @@ suite("test_aggregate_all_functions", "query") {
qt_select43 "select MIN_BY(id,level) from ${tableName_12}"
sql "DROP TABLE IF EXISTS ${tableName_10}"
+
+ qt_select44 """ select sum(distinct k1), sum(distinct k2), sum(distinct k3), sum(distinct cast(k4 as largeint)), sum(distinct k5), sum(distinct k8), sum(distinct k9) from test_query_db.test """
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org