mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 13:42:02 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
39 lines
629 B
C++
39 lines
629 B
C++
#pragma once
|
|
|
|
#include <queue>
|
|
#include <Processors/IAccumulatingTransform.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class QueueBuffer : public IAccumulatingTransform
|
|
{
|
|
private:
|
|
std::queue<Chunk> chunks;
|
|
public:
|
|
String getName() const override { return "QueueBuffer"; }
|
|
|
|
QueueBuffer(Block header)
|
|
: IAccumulatingTransform(header, header)
|
|
{
|
|
}
|
|
|
|
void consume(Chunk block) override
|
|
{
|
|
chunks.push(std::move(block));
|
|
}
|
|
|
|
Chunk generate() override
|
|
{
|
|
if (chunks.empty())
|
|
return {};
|
|
|
|
auto res = std::move(chunks.front());
|
|
chunks.pop();
|
|
return res;
|
|
}
|
|
};
|
|
|
|
}
|