mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-19 14:11:58 +00:00
fafecb3c25
* Formats: better modularity (development) #2447 * Formats: better modularity (development) #2447 * Formats: better modularity (development) #2447 * Formats: better modularity (development) #2447 * Formats: better modularity (development) #2447 * Formats: better modularity (development): removed very old tests #2447 * Formats: better modularity (development) #2447 * Formats: better modularity (development) #2447 * Formats: better modularity (development) #2447 * Formats: better modularity (development) #2447 * Formats: better modularity (development) #2447 * Formats: better modularity (development) #2447 * Formats: better modularity (development) #2447 * Formats: better modularity (development) #2447
41 lines
931 B
C++
41 lines
931 B
C++
#include <IO/WriteBuffer.h>
|
|
#include <Columns/IColumn.h>
|
|
#include <DataTypes/IDataType.h>
|
|
#include <Formats/BinaryRowOutputStream.h>
|
|
#include <Formats/FormatFactory.h>
|
|
#include <Formats/BlockOutputStreamFromRowOutputStream.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
BinaryRowOutputStream::BinaryRowOutputStream(WriteBuffer & ostr_)
|
|
: ostr(ostr_)
|
|
{
|
|
}
|
|
|
|
void BinaryRowOutputStream::flush()
|
|
{
|
|
ostr.next();
|
|
}
|
|
|
|
void BinaryRowOutputStream::writeField(const IColumn & column, const IDataType & type, size_t row_num)
|
|
{
|
|
type.serializeBinary(column, row_num, ostr);
|
|
}
|
|
|
|
void registerOutputFormatRowBinary(FormatFactory & factory)
|
|
{
|
|
factory.registerOutputFormat("RowBinary", [](
|
|
WriteBuffer & buf,
|
|
const Block & sample,
|
|
const Context &,
|
|
const FormatSettings &)
|
|
{
|
|
return std::make_shared<BlockOutputStreamFromRowOutputStream>(
|
|
std::make_shared<BinaryRowOutputStream>(buf), sample);
|
|
});
|
|
}
|
|
|
|
}
|