You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2023/01/08 01:53:04 UTC
[doris] 01/04: [vectorized](udaf) fix udaf result is null when has multiple aggs (#15554)
This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 0b7257b5519329d59e13ab1a88e477460c475ab3
Author: zhangstar333 <87...@users.noreply.github.com>
AuthorDate: Tue Jan 3 16:03:43 2023 +0800
[vectorized](udaf) fix udaf result is null when has multiple aggs (#15554)
---
.../vec/aggregate_functions/aggregate_function_java_udaf.h | 4 ++--
regression-test/data/javaudf_p0/test_javaudaf_mysum_int.out | 12 ++++++++++++
.../suites/javaudf_p0/test_javaudaf_mysum_int.groovy | 4 ++++
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/be/src/vec/aggregate_functions/aggregate_function_java_udaf.h b/be/src/vec/aggregate_functions/aggregate_function_java_udaf.h
index 113277498c..0671f716e1 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_java_udaf.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_java_udaf.h
@@ -348,11 +348,11 @@ public:
<< _fn.name.function_name;
}
- void add_batch(size_t batch_size, AggregateDataPtr* places, size_t /*place_offset*/,
+ void add_batch(size_t batch_size, AggregateDataPtr* places, size_t place_offset,
const IColumn** columns, Arena* /*arena*/, bool /*agg_many*/) const override {
int64_t places_address[batch_size];
for (size_t i = 0; i < batch_size; ++i) {
- places_address[i] = reinterpret_cast<int64_t>(places[i]);
+ places_address[i] = reinterpret_cast<int64_t>(places[i] + place_offset);
}
this->data(_exec_place).add(places_address, false, columns, 0, batch_size, argument_types);
}
diff --git a/regression-test/data/javaudf_p0/test_javaudaf_mysum_int.out b/regression-test/data/javaudf_p0/test_javaudaf_mysum_int.out
index 11092feaae..47c14ac114 100644
--- a/regression-test/data/javaudf_p0/test_javaudaf_mysum_int.out
+++ b/regression-test/data/javaudf_p0/test_javaudaf_mysum_int.out
@@ -19,3 +19,15 @@
2 6
9 9
+-- !select3 --
+0 0 0
+1 3 3
+2 6 6
+9 9 9
+
+-- !select4 --
+0 0 0
+1 3 3
+2 6 6
+9 9 9
+
diff --git a/regression-test/suites/javaudf_p0/test_javaudaf_mysum_int.groovy b/regression-test/suites/javaudf_p0/test_javaudaf_mysum_int.groovy
index fd9af7eb61..cd7ee3779f 100644
--- a/regression-test/suites/javaudf_p0/test_javaudaf_mysum_int.groovy
+++ b/regression-test/suites/javaudf_p0/test_javaudaf_mysum_int.groovy
@@ -67,6 +67,10 @@ suite("test_javaudaf_mysum_int") {
qt_select1 """ SELECT udaf_my_sum_int(user_id) result FROM ${tableName}; """
qt_select2 """ select user_id, udaf_my_sum_int(user_id) from ${tableName} group by user_id order by user_id; """
+
+ qt_select3 """ select user_id, sum(user_id), udaf_my_sum_int(user_id) from ${tableName} group by user_id order by user_id; """
+
+ qt_select4 """ select user_id, udaf_my_sum_int(user_id), sum(user_id) from ${tableName} group by user_id order by user_id; """
sql """ DROP FUNCTION udaf_my_sum_int(int); """
} finally {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org