[BUG] Fix except wrong answer bug (#4369)

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.
This commit is contained in:
lichaoyong
2020-08-18 09:23:48 +08:00
committed by GitHub
parent 26fe510011
commit d5e456a3c3

View File

@ -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<false>();
}