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

40 lines
719 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);
2010-03-12 18:25:35 +00:00
String getName() const override { return "LimitBlockInputStream"; }
String getID() const override
{
std::stringstream res;
2013-05-04 05:20:07 +00:00
res << "Limit(" << children.back()->getID() << ", " << limit << ", " << offset << ")";
return res.str();
}
2012-10-20 02:10:47 +00:00
protected:
Block readImpl() override;
2012-10-20 02:10:47 +00:00
2010-03-12 18:25:35 +00:00
private:
size_t limit;
size_t offset;
size_t pos;
};
}