mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Update LimitTransform.
This commit is contained in:
parent
75185e5b40
commit
4b0cac25d1
@ -92,9 +92,23 @@ IProcessor::Status LimitTransform::prepare(
|
||||
for (auto pos : updated_output_ports)
|
||||
process_pair(pos);
|
||||
|
||||
/// All ports are finished. It may happen even before we reached the limit (has less data then limit).
|
||||
if (num_finished_port_pairs == input_ports.size())
|
||||
return Status::Finished;
|
||||
|
||||
/// If we reached limit for some port, then close others. Otherwise some sources may infinitely read data.
|
||||
/// Example: SELECT * FROM system.numbers_mt WHERE number = 1000000 LIMIT 1
|
||||
if ((rows_read >= offset + limit) && !previous_row_chunk && !always_read_till_end)
|
||||
{
|
||||
for (auto & input : inputs)
|
||||
input.close();
|
||||
|
||||
for (auto & output : outputs)
|
||||
output.finish();
|
||||
|
||||
return Status::Finished;
|
||||
}
|
||||
|
||||
if (has_full_port)
|
||||
return Status::PortFull;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user