Avoid creating unnecessary sources

This commit is contained in:
János Benjamin Antal 2024-07-10 11:20:05 +00:00
parent 2442473b25
commit a92eb1a4c3

View File

@ -582,6 +582,10 @@ Pipe ReadFromSystemNumbersStep::makePipe()
const auto step_between_chunks = num_streams * block_range;
for (size_t i = 0; i < num_streams; ++i)
{
const auto source_start = numbers_storage.offset + i * block_range;
if (numbers_storage.limit.has_value() && *numbers_storage.limit < source_start)
break;
auto source = std::make_shared<NumbersSource>(
max_block_size,
numbers_storage.offset + i * block_range,