From dd7d3c356a8f20c092e9281df025f30d658805ee Mon Sep 17 00:00:00 2001 From: chaoyli Date: Mon, 17 Aug 2020 11:26:09 +0800 Subject: [PATCH] [BUG] Fix except wrong answer bug Doris use HashTable to implement except. If user send A except B except C, first do A except B and then except C. After A except B, HashTable will be rebuild. There is a bug here to throw some rows. --- be/src/exec/except_node.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/be/src/exec/except_node.cpp b/be/src/exec/except_node.cpp index 1411647b62dc53..237b9b2c89b3f3 100644 --- a/be/src/exec/except_node.cpp +++ b/be/src/exec/except_node.cpp @@ -56,16 +56,12 @@ Status ExceptNode::open(RuntimeState* state) { new HashTable(_child_expr_lists[0], _child_expr_lists[i], _build_tuple_size, true, _find_nulls, id(), mem_tracker(), 1024)); _hash_tbl_iterator = _hash_tbl->begin(); - uint32_t previous_hash = -1; while (_hash_tbl_iterator.has_next()) { - if (previous_hash != _hash_tbl_iterator.get_hash()) { - previous_hash = _hash_tbl_iterator.get_hash(); - if (!_hash_tbl_iterator.matched()) { - VLOG_ROW << "rebuild row: " - << get_row_output_string(_hash_tbl_iterator.get_row(), - child(0)->row_desc()); - temp_tbl->insert(_hash_tbl_iterator.get_row()); - } + if (!_hash_tbl_iterator.matched()) { + VLOG_ROW << "rebuild row: " + << get_row_output_string(_hash_tbl_iterator.get_row(), + child(0)->row_desc()); + temp_tbl->insert(_hash_tbl_iterator.get_row()); } _hash_tbl_iterator.next(); }