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

36 lines
648 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);
2012-10-20 02:10:47 +00:00
2011-09-04 21:23:19 +00:00
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); }
2012-10-20 02:10:47 +00:00
protected:
Block readImpl();
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;
};
}