Skip to content

Commit

Permalink
[BugFix] Fix spill group by limit hang (StarRocks#42583)
Browse files Browse the repository at this point in the history
Signed-off-by: stdpain <[email protected]>
  • Loading branch information
stdpain committed Apr 19, 2024
1 parent c557fd8 commit 742b55b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ Status SpillableAggregateBlockingSinkOperator::push_chunk(RuntimeState* state, c
}

Status SpillableAggregateBlockingSinkOperator::_spill_all_inputs(RuntimeState* state, const ChunkPtr& chunk) {
RETURN_IF(_aggregator->hash_map_variant().size() == 0, Status::OK());
// spill all data
DCHECK(!_aggregator->is_none_group_by_exprs());
_aggregator->hash_map_variant().visit(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,15 @@ Status SpillableAggregateDistinctBlockingSinkOperator::push_chunk(RuntimeState*
}
RETURN_IF_ERROR(AggregateDistinctBlockingSinkOperator::push_chunk(state, chunk));
set_revocable_mem_bytes(_aggregator->hash_set_memory_usage());
if (_is_finished) return Status::OK();
if (_spill_strategy == spill::SpillStrategy::SPILL_ALL) {
return _spill_all_inputs(state, chunk);
}
return Status::OK();
}

Status SpillableAggregateDistinctBlockingSinkOperator::_spill_all_inputs(RuntimeState* state, const ChunkPtr& chunk) {
RETURN_IF(_aggregator->hash_set_variant().size() == 0, Status::OK());
_aggregator->hash_set_variant().visit(
[&](auto& hash_set_with_key) { _aggregator->it_hash() = hash_set_with_key->hash_set.begin(); });
CHECK(!_aggregator->spill_channel()->has_task());
Expand Down

0 comments on commit 742b55b

Please sign in to comment.