ClickHouse/dbms/include/DB/DataStreams/LimitBlockInputStream.h
2011-10-24 12:10:59 +00:00

34 lines
635 B
C++

#pragma once
#include <Poco/SharedPtr.h>
#include <DB/DataStreams/IProfilingBlockInputStream.h>
namespace DB
{
using Poco::SharedPtr;
/** Реализует реляционную операцию LIMIT.
*/
class LimitBlockInputStream : public IProfilingBlockInputStream
{
public:
LimitBlockInputStream(BlockInputStreamPtr input_, size_t limit_, size_t offset_ = 0);
Block readImpl();
String getName() const { return "LimitBlockInputStream"; }
BlockInputStreamPtr clone() { return new LimitBlockInputStream(input, limit, offset); }
private:
BlockInputStreamPtr input;
size_t limit;
size_t offset;
size_t pos;
};
}