ClickHouse/dbms/include/DB/DataStreams/LimitBlockInputStream.h

34 lines
635 B
C
Raw Normal View History

2011-09-04 21:23:19 +00:00
#pragma once
2010-03-12 18:25:35 +00:00
#include <Poco/SharedPtr.h>
2011-09-04 21:23:19 +00:00
#include <DB/DataStreams/IProfilingBlockInputStream.h>
2010-03-12 18:25:35 +00:00
namespace DB
{
using Poco::SharedPtr;
/** Реализует реляционную операцию LIMIT.
*/
2011-09-04 21:23:19 +00:00
class LimitBlockInputStream : public IProfilingBlockInputStream
2010-03-12 18:25:35 +00:00
{
public:
2011-08-28 02:22:23 +00:00
LimitBlockInputStream(BlockInputStreamPtr input_, size_t limit_, size_t offset_ = 0);
2011-09-04 21:23:19 +00:00
Block readImpl();
String getName() const { return "LimitBlockInputStream"; }
2010-03-12 18:25:35 +00:00
2011-10-24 12:10:59 +00:00
BlockInputStreamPtr clone() { return new LimitBlockInputStream(input, limit, offset); }
2010-03-12 18:25:35 +00:00
private:
2011-08-28 02:22:23 +00:00
BlockInputStreamPtr input;
2010-03-12 18:25:35 +00:00
size_t limit;
size_t offset;
size_t pos;
};
}