2018-05-23 20:19:33 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Processors/IProcessor.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class LimitTransform : public IProcessor
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
InputPort & input;
|
|
|
|
OutputPort & output;
|
|
|
|
|
|
|
|
size_t limit;
|
|
|
|
size_t offset;
|
|
|
|
size_t rows_read = 0; /// including the last read block
|
|
|
|
bool always_read_till_end;
|
|
|
|
|
2019-02-07 18:51:53 +00:00
|
|
|
bool has_block = false;
|
|
|
|
bool block_processed = false;
|
2019-02-18 16:36:07 +00:00
|
|
|
Chunk current_chunk;
|
2018-05-23 20:19:33 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
LimitTransform(Block header, size_t limit, size_t offset, bool always_read_till_end = false);
|
|
|
|
|
|
|
|
String getName() const override { return "Limit"; }
|
|
|
|
|
|
|
|
Status prepare() override;
|
|
|
|
void work() override;
|
|
|
|
|
|
|
|
InputPort & getInputPort() { return input; }
|
|
|
|
OutputPort & getOutputPort() { return output; }
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|