mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <DB/Core/Defines.h>
|
|
#include <DB/DataStreams/IProfilingBlockInputStream.h>
|
|
#include <DB/DataStreams/IRowInputStream.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/** Преобразует поток для чтения данных по строкам в поток для чтения данных по блокам.
|
|
* Наример, для чтения текстового дампа.
|
|
*/
|
|
class BlockInputStreamFromRowInputStream : public IProfilingBlockInputStream
|
|
{
|
|
public:
|
|
/** sample_ - пустой блок, который описывает, как интерпретировать значения */
|
|
BlockInputStreamFromRowInputStream(
|
|
RowInputStreamPtr row_input_,
|
|
const Block & sample_,
|
|
size_t max_block_size_ = DEFAULT_BLOCK_SIZE);
|
|
|
|
void readPrefix() { row_input->readPrefix(); }
|
|
void readSuffix() { row_input->readSuffix(); }
|
|
|
|
String getName() const { return "BlockInputStreamFromRowInputStream"; }
|
|
|
|
String getID() const
|
|
{
|
|
std::stringstream res;
|
|
res << this;
|
|
return res.str();
|
|
}
|
|
|
|
protected:
|
|
Block readImpl();
|
|
|
|
private:
|
|
RowInputStreamPtr row_input;
|
|
const Block sample;
|
|
size_t max_block_size;
|
|
size_t total_rows;
|
|
};
|
|
|
|
}
|