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

34 lines
1.1 KiB
C
Raw Normal View History

2011-08-19 19:18:15 +00:00
#pragma once
#include <DB/DataTypes/DataTypeFactory.h>
2011-09-04 21:23:19 +00:00
#include <DB/DataStreams/IProfilingBlockInputStream.h>
2011-08-19 19:18:15 +00:00
namespace DB
{
/** Десериализует поток блоков из родного бинарного формата (с именами и типами столбцов).
* Предназначено для взаимодействия между серверами.
*/
2011-09-04 21:23:19 +00:00
class NativeBlockInputStream : public IProfilingBlockInputStream
2011-08-19 19:18:15 +00:00
{
public:
2012-08-02 17:33:31 +00:00
NativeBlockInputStream(ReadBuffer & istr_, const DataTypeFactory & data_type_factory_)
2011-08-19 19:18:15 +00:00
: istr(istr_), data_type_factory(data_type_factory_) {}
/** Прочитать следующий блок.
* Если блоков больше нет - вернуть пустой блок (для которого operator bool возвращает false).
*/
2011-09-04 21:23:19 +00:00
Block readImpl();
String getName() const { return "NativeBlockInputStream"; }
2011-08-19 19:18:15 +00:00
2011-10-24 12:10:59 +00:00
BlockInputStreamPtr clone() { return new NativeBlockInputStream(istr, data_type_factory); }
2011-08-19 19:18:15 +00:00
private:
ReadBuffer & istr;
2012-08-02 17:33:31 +00:00
const DataTypeFactory & data_type_factory;
2011-08-19 19:18:15 +00:00
};
}