Merge pull request #72405 from ClickHouse/fix_uncaught_exc

Fix uncaught exception in ScatteredBlock
This commit is contained in:
Nikita Taranov 2024-11-26 13:21:00 +00:00 committed by GitHub
commit cb2249e4a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -302,10 +302,11 @@ struct ScatteredBlock : private boost::noncopyable
/// Cut first `num_rows` rows from `block` in place and returns block with remaining rows
ScatteredBlock cut(size_t num_rows)
{
SCOPE_EXIT(filterBySelector());
if (num_rows >= rows())
{
filterBySelector();
return ScatteredBlock{Block{}};
}
chassert(block);
@ -314,6 +315,7 @@ struct ScatteredBlock : private boost::noncopyable
auto remaining = ScatteredBlock{block, std::move(remaining_selector)};
selector = std::move(first_num_rows);
filterBySelector();
return remaining;
}