ClickHouse/dbms/include/DB/DataStreams/BlockInputStreamFromRowInputStream.h

41 lines
1.2 KiB
C
Raw Normal View History

2011-09-04 21:23:19 +00:00
#pragma once
2010-05-21 19:52:50 +00:00
#include <DB/Core/Defines.h>
2011-09-04 21:23:19 +00:00
#include <DB/DataStreams/IProfilingBlockInputStream.h>
2010-05-21 19:52:50 +00:00
#include <DB/DataStreams/IRowInputStream.h>
namespace DB
{
/** Преобразует поток для чтения данных по строкам в поток для чтения данных по блокам.
* Наример, для чтения текстового дампа.
*/
2011-09-04 21:23:19 +00:00
class BlockInputStreamFromRowInputStream : public IProfilingBlockInputStream
2010-05-21 19:52:50 +00:00
{
public:
/** sample_ - пустой блок, который описывает, как интерпретировать значения */
BlockInputStreamFromRowInputStream(
2011-10-24 12:10:59 +00:00
RowInputStreamPtr row_input_,
2010-05-21 19:52:50 +00:00
const Block & sample_,
size_t max_block_size_ = DEFAULT_BLOCK_SIZE);
2011-11-06 06:22:52 +00:00
void readPrefix() { row_input->readPrefix(); }
void readSuffix() { row_input->readSuffix(); }
2011-09-04 21:23:19 +00:00
String getName() const { return "BlockInputStreamFromRowInputStream"; }
2010-05-21 19:52:50 +00:00
2011-10-24 12:10:59 +00:00
BlockInputStreamPtr clone() { return new BlockInputStreamFromRowInputStream(row_input, sample, max_block_size); }
2012-10-20 02:10:47 +00:00
protected:
Block readImpl();
2010-05-21 19:52:50 +00:00
private:
2011-10-24 12:10:59 +00:00
RowInputStreamPtr row_input;
2012-10-10 18:32:45 +00:00
const Block sample;
2010-05-21 19:52:50 +00:00
size_t max_block_size;
2012-05-08 11:39:28 +00:00
bool first_row;
2010-05-21 19:52:50 +00:00
};
}