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 f2fa9606c9 [fix](agg)count function should return 0 for null value
(#13247)
f2fa9606c9 is described below
commit f2fa9606c9bdee42568286e634d3061db3f6ff38
Author: starocean999 <[email protected]>
AuthorDate: Sat Oct 15 10:40:52 2022 +0800
[fix](agg)count function should return 0 for null value (#13247)
count(null) should return 0 instead of 1, the
streaming_agg_serialize_to_column function didn't handle if the input value is
null, this pr fix it.
---
be/src/vec/aggregate_functions/aggregate_function_count.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/be/src/vec/aggregate_functions/aggregate_function_count.h
b/be/src/vec/aggregate_functions/aggregate_function_count.h
index 8ab6b53e56..883a3b5c23 100644
--- a/be/src/vec/aggregate_functions/aggregate_function_count.h
+++ b/be/src/vec/aggregate_functions/aggregate_function_count.h
@@ -189,7 +189,11 @@ public:
const size_t num_rows, Arena*
arena) const override {
auto& col = assert_cast<ColumnUInt64&>(*dst);
col.resize(num_rows);
- col.get_data().assign(num_rows, 1UL);
+ auto& data = col.get_data();
+ const ColumnNullable& input_col = assert_cast<const
ColumnNullable&>(*columns[0]);
+ for (size_t i = 0; i < num_rows; i++) {
+ data[i] = !input_col.is_null_at(i);
+ }
}
void deserialize_and_merge_from_column(AggregateDataPtr __restrict place,
const IColumn& column,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]