ClickHouse/dbms/src/DataStreams/TabSeparatedBlockOutputStream.cpp

34 lines
695 B
C++
Raw Normal View History

#include <IO/WriteBuffer.h>
#include <Core/Block.h>
#include <DataStreams/TabSeparatedBlockOutputStream.h>
namespace DB
{
2016-08-13 01:57:35 +00:00
void TabSeparatedBlockOutputStream::flush()
{
ostr.next();
2016-08-13 01:57:35 +00:00
}
void TabSeparatedBlockOutputStream::write(const Block & block)
{
size_t columns = block.columns();
for (size_t i = 0; i < columns; ++i)
{
const ColumnWithTypeAndName & col = block.safeGetByPosition(i);
size_t rows = block.rows();
for (size_t j = 0; j < rows; ++j)
{
if (j != 0)
ostr.write('\t');
col.type->serializeTextEscaped(*col.column, j, ostr);
}
ostr.write('\n');
}
ostr.write('\n');
}
}