mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 01:51:59 +00:00
Remove BinaryRowOutputStream.
This commit is contained in:
parent
03ece9dc99
commit
342f044241
@ -1,77 +0,0 @@
|
||||
#include <IO/WriteBuffer.h>
|
||||
#include <IO/WriteHelpers.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_, const Block & sample_, bool with_names_, bool with_types_)
|
||||
: ostr(ostr_), with_names(with_names_), with_types(with_types_), sample(sample_)
|
||||
{
|
||||
}
|
||||
|
||||
void BinaryRowOutputStream::writePrefix()
|
||||
{
|
||||
size_t columns = sample.columns();
|
||||
|
||||
if (with_names || with_types)
|
||||
{
|
||||
writeVarUInt(columns, ostr);
|
||||
}
|
||||
|
||||
if (with_names)
|
||||
{
|
||||
for (size_t i = 0; i < columns; ++i)
|
||||
{
|
||||
writeStringBinary(sample.safeGetByPosition(i).name, ostr);
|
||||
}
|
||||
}
|
||||
|
||||
if (with_types)
|
||||
{
|
||||
for (size_t i = 0; i < columns; ++i)
|
||||
{
|
||||
writeStringBinary(sample.safeGetByPosition(i).type->getName(), 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, false, false), sample);
|
||||
});
|
||||
|
||||
factory.registerOutputFormat("RowBinaryWithNamesAndTypes", [](
|
||||
WriteBuffer & buf,
|
||||
const Block & sample,
|
||||
const Context &,
|
||||
const FormatSettings &)
|
||||
{
|
||||
return std::make_shared<BlockOutputStreamFromRowOutputStream>(
|
||||
std::make_shared<BinaryRowOutputStream>(buf, sample, true, true), sample);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <Formats/IRowOutputStream.h>
|
||||
#include <Core/Block.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
|
||||
class IColumn;
|
||||
class IDataType;
|
||||
class WriteBuffer;
|
||||
|
||||
|
||||
/** A stream for outputting data in a binary line-by-line format.
|
||||
*/
|
||||
class BinaryRowOutputStream : public IRowOutputStream
|
||||
{
|
||||
public:
|
||||
BinaryRowOutputStream(WriteBuffer & ostr_, const Block & sample_, bool with_names_, bool with_types_);
|
||||
|
||||
void writeField(const IColumn & column, const IDataType & type, size_t row_num) override;
|
||||
void writePrefix() override;
|
||||
|
||||
void flush() override;
|
||||
|
||||
String getContentType() const override { return "application/octet-stream"; }
|
||||
|
||||
protected:
|
||||
WriteBuffer & ostr;
|
||||
bool with_names;
|
||||
bool with_types;
|
||||
const Block sample;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -199,7 +199,6 @@ void FormatFactory::registerOutputFormatProcessor(const String & name, OutputPro
|
||||
|
||||
void registerInputFormatNative(FormatFactory & factory);
|
||||
void registerOutputFormatNative(FormatFactory & factory);
|
||||
void registerOutputFormatRowBinary(FormatFactory & factory);
|
||||
void registerInputFormatTabSeparated(FormatFactory & factory);
|
||||
void registerOutputFormatTabSeparated(FormatFactory & factory);
|
||||
void registerInputFormatValues(FormatFactory & factory);
|
||||
@ -270,7 +269,6 @@ FormatFactory::FormatFactory()
|
||||
{
|
||||
registerInputFormatNative(*this);
|
||||
registerOutputFormatNative(*this);
|
||||
registerOutputFormatRowBinary(*this);
|
||||
registerInputFormatTabSeparated(*this);
|
||||
registerOutputFormatTabSeparated(*this);
|
||||
registerInputFormatValues(*this);
|
||||
|
Loading…
Reference in New Issue
Block a user