2012-05-08 11:19:00 +00:00
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <DB/DataStreams/IProfilingBlockInputStream.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/** Поток блоков, из которого можно прочитать один блок.
|
2015-12-01 14:09:05 +00:00
|
|
|
|
* Также смотрите BlocksListBlockInputStream.
|
2012-05-08 11:19:00 +00:00
|
|
|
|
*/
|
|
|
|
|
class OneBlockInputStream : public IProfilingBlockInputStream
|
|
|
|
|
{
|
|
|
|
|
public:
|
2017-04-01 07:20:54 +00:00
|
|
|
|
OneBlockInputStream(const Block & block_) : block(block_) {}
|
2012-05-08 11:19:00 +00:00
|
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
|
String getName() const override { return "One"; }
|
2012-10-20 02:10:47 +00:00
|
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
|
String getID() const override
|
|
|
|
|
{
|
|
|
|
|
std::stringstream res;
|
|
|
|
|
res << this;
|
|
|
|
|
return res.str();
|
|
|
|
|
}
|
2013-05-03 10:20:53 +00:00
|
|
|
|
|
2012-10-20 02:10:47 +00:00
|
|
|
|
protected:
|
2017-04-01 07:20:54 +00:00
|
|
|
|
Block readImpl() override
|
|
|
|
|
{
|
|
|
|
|
if (has_been_read)
|
|
|
|
|
return Block();
|
2012-05-08 11:19:00 +00:00
|
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
|
has_been_read = true;
|
|
|
|
|
return block;
|
|
|
|
|
}
|
2012-05-08 11:19:00 +00:00
|
|
|
|
|
|
|
|
|
private:
|
2017-04-01 07:20:54 +00:00
|
|
|
|
Block block;
|
|
|
|
|
bool has_been_read = false;
|
2012-05-08 11:19:00 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|