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/19 15:25:34 UTC

[doris] branch master updated: [fix]Empty string key in aggregation was output as NULL (#11011)

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 fd2c374426 [fix]Empty string key in aggregation was output as NULL (#11011)
fd2c374426 is described below

commit fd2c374426cfc3dcc018ee4ddcbfe8537f9beeee
Author: Jerry Hu <mr...@gmail.com>
AuthorDate: Tue Jul 19 23:25:28 2022 +0800

    [fix]Empty string key in aggregation was output as NULL (#11011)
---
 be/src/vec/common/hash_table/string_hash_table.h | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/be/src/vec/common/hash_table/string_hash_table.h b/be/src/vec/common/hash_table/string_hash_table.h
index bffd0f1e80..b6e4a04da7 100644
--- a/be/src/vec/common/hash_table/string_hash_table.h
+++ b/be/src/vec/common/hash_table/string_hash_table.h
@@ -94,9 +94,10 @@ struct StringHashTableEmpty //-V730
 public:
     bool has_zero() const { return _has_zero; }
 
-    void set_has_zero() {
+    void set_has_zero(const typename Cell::key_type& key) {
         _has_zero = true;
         new (zero_value()) Cell();
+        zero_value()->value.first = key;
     }
 
     void set_has_zero(const Cell& other) {
@@ -118,9 +119,11 @@ public:
     using ConstLookupResult = const Cell*;
 
     template <typename KeyHolder>
-    void ALWAYS_INLINE emplace(KeyHolder&&, LookupResult& it, bool& inserted, size_t = 0) {
+    void ALWAYS_INLINE emplace(KeyHolder&& key_holder, LookupResult& it, bool& inserted,
+                               size_t = 0) {
         if (!has_zero()) {
-            set_has_zero();
+            const auto& key = key_holder_get_key(key_holder);
+            set_has_zero(key);
             inserted = true;
         } else
             inserted = false;
@@ -467,7 +470,7 @@ public:
         const size_t sz = x.size;
         if (sz == 0) {
             key_holder_discard_key(key_holder);
-            return func(self.m0, VoidKey {}, 0);
+            return func(self.m0, std::forward<KeyHolder>(key_holder), 0);
         }
 
         if (x.data[sz - 1] == 0) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org