mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
42 lines
721 B
C++
42 lines
721 B
C++
#pragma once
|
|
|
|
#include <DB/DataStreams/IProfilingBlockInputStream.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/** Поток блоков, из которого можно прочитать один блок.
|
|
* Также смотрите BlocksListBlockInputStream.
|
|
*/
|
|
class OneBlockInputStream : public IProfilingBlockInputStream
|
|
{
|
|
public:
|
|
OneBlockInputStream(const Block & block_) : block(block_) {}
|
|
|
|
String getName() const override { return "One"; }
|
|
|
|
String getID() const override
|
|
{
|
|
std::stringstream res;
|
|
res << this;
|
|
return res.str();
|
|
}
|
|
|
|
protected:
|
|
Block readImpl() override
|
|
{
|
|
if (has_been_read)
|
|
return Block();
|
|
|
|
has_been_read = true;
|
|
return block;
|
|
}
|
|
|
|
private:
|
|
Block block;
|
|
bool has_been_read = false;
|
|
};
|
|
|
|
}
|