mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
47 lines
1.0 KiB
C++
47 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include <Core/Block.h>
|
|
#include <DataStreams/IBlockInputStream.h>
|
|
#include <Core/ExternalResultDescription.h>
|
|
|
|
|
|
namespace Poco
|
|
{
|
|
namespace MongoDB
|
|
{
|
|
class Connection;
|
|
class Cursor;
|
|
}
|
|
}
|
|
|
|
|
|
namespace DB
|
|
{
|
|
/// Converts MongoDB Cursor to a stream of Blocks
|
|
class MongoDBBlockInputStream final : public IBlockInputStream
|
|
{
|
|
public:
|
|
MongoDBBlockInputStream(
|
|
std::shared_ptr<Poco::MongoDB::Connection> & connection_,
|
|
std::unique_ptr<Poco::MongoDB::Cursor> cursor_,
|
|
const Block & sample_block,
|
|
const UInt64 max_block_size_);
|
|
|
|
~MongoDBBlockInputStream() override;
|
|
|
|
String getName() const override { return "MongoDB"; }
|
|
|
|
Block getHeader() const override { return description.sample_block.cloneEmpty(); }
|
|
|
|
private:
|
|
Block readImpl() override;
|
|
|
|
std::shared_ptr<Poco::MongoDB::Connection> connection;
|
|
std::unique_ptr<Poco::MongoDB::Cursor> cursor;
|
|
const UInt64 max_block_size;
|
|
ExternalResultDescription description;
|
|
bool all_read = false;
|
|
};
|
|
|
|
}
|