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 2021/08/07 13:33:51 UTC

[incubator-doris] branch master updated: [BUG] Fix Left Semi Join Got a Wrong Result (#6379)

This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 3519a4f  [BUG] Fix Left Semi Join Got a Wrong Result (#6379)
3519a4f is described below

commit 3519a4ff476804775cefe99f89a91f4a3f9a531b
Author: stdpain <34...@users.noreply.github.com>
AuthorDate: Sat Aug 7 21:33:44 2021 +0800

    [BUG] Fix Left Semi Join Got a Wrong Result (#6379)
    
    ```
    SELECT count(distinct products_id) FROM a_table as a WHERE 1=1 AND products_id in ( SELECT products_id from b_table );
    ```
    Because hash table construction errors may lead to unstable results
---
 be/src/exec/hash_table.hpp | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/be/src/exec/hash_table.hpp b/be/src/exec/hash_table.hpp
index 2e655ff..4b679c7 100644
--- a/be/src/exec/hash_table.hpp
+++ b/be/src/exec/hash_table.hpp
@@ -23,6 +23,13 @@
 namespace doris {
 
 inline bool HashTable::emplace_key(TupleRow* row, TupleRow** dest_addr) {
+    if (_num_filled_buckets > _num_buckets_till_resize) {
+        resize_buckets(_num_buckets * 2);
+    }
+    if (_current_used == _current_capacity) {
+        grow_node_array();
+    }
+
     bool has_nulls = eval_build_row(row);
 
     if (!_stores_nulls && has_nulls) {
@@ -52,14 +59,6 @@ inline bool HashTable::emplace_key(TupleRow* row, TupleRow** dest_addr) {
         node = last_node;
     }
     if (will_insert) {
-        if (_num_filled_buckets > _num_buckets_till_resize) {
-            resize_buckets(_num_buckets * 2);
-            // real bucket_id will modify after resize buckets
-            bucket_idx = hash & (_num_buckets - 1);
-        }
-        if (_current_used == _current_capacity) {
-            grow_node_array();
-        }
         Node* alloc_node =
                 reinterpret_cast<Node*>(_current_nodes + _node_byte_size * _current_used++);
         ++_num_nodes;

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