[Bug](union) fix union operator set eos is not incorrect (#34250)
* [test](case) fix unstable case without order by distinct row * [Bug](union) fix union operator set eos is not incorrect
This commit is contained in:
@ -172,12 +172,20 @@ std::string UnionSourceLocalState::debug_string(int indentation_level) const {
|
||||
Status UnionSourceOperatorX::get_block(RuntimeState* state, vectorized::Block* block, bool* eos) {
|
||||
auto& local_state = get_local_state(state);
|
||||
Defer set_eos {[&]() {
|
||||
//have executing const expr, queue have no data anymore, and child could be closed
|
||||
*eos = (_child_size == 0 && !local_state._need_read_for_const_expr) ||
|
||||
// here should check `_has_data` first, or when `is_all_finish` is false,
|
||||
// the data queue will have no chance to change the `_flag_queue_idx`.
|
||||
(!_has_data(state) && _child_size > 0 &&
|
||||
local_state._shared_state->data_queue.is_all_finish());
|
||||
// the eos check of union operator is complex, need check all logical if you want modify
|
||||
// could ref this PR: https://github.com/apache/doris/pull/29677
|
||||
// have executing const expr, queue have no data anymore, and child could be closed
|
||||
if (_child_size == 0 && !local_state._need_read_for_const_expr) {
|
||||
*eos = true;
|
||||
} else if (_has_data(state)) {
|
||||
*eos = false;
|
||||
} else if (local_state._shared_state->data_queue.is_all_finish()) {
|
||||
// Here, check the value of `_has_data(state)` again after `data_queue.is_all_finish()` is TRUE
|
||||
// as there may be one or more blocks when `data_queue.is_all_finish()` is TRUE.
|
||||
*eos = !_has_data(state);
|
||||
} else {
|
||||
*eos = false;
|
||||
}
|
||||
}};
|
||||
|
||||
SCOPED_TIMER(local_state.exec_time_counter());
|
||||
|
||||
Reference in New Issue
Block a user