2019-02-22 13:51:25 +00:00
|
|
|
#include <Common/Exception.h>
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Core/Block.h>
|
2018-06-10 19:22:49 +00:00
|
|
|
#include <Formats/IRowOutputStream.h>
|
2010-03-04 19:20:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2019-02-22 13:51:25 +00:00
|
|
|
namespace ErrorCodes
|
|
|
|
{
|
|
|
|
extern const int NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2010-03-04 19:20:28 +00:00
|
|
|
|
2016-02-16 16:39:39 +00:00
|
|
|
void IRowOutputStream::write(const Block & block, size_t row_num)
|
2010-03-04 19:20:28 +00:00
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
size_t columns = block.columns();
|
2016-02-16 16:39:39 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
writeRowStartDelimiter();
|
2010-03-04 19:20:28 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
for (size_t i = 0; i < columns; ++i)
|
|
|
|
{
|
|
|
|
if (i != 0)
|
|
|
|
writeFieldDelimiter();
|
2016-02-16 16:39:39 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
auto & col = block.getByPosition(i);
|
2017-09-01 18:21:01 +00:00
|
|
|
writeField(*col.column, *col.type, row_num);
|
2017-04-01 07:20:54 +00:00
|
|
|
}
|
2016-02-16 16:39:39 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
writeRowEndDelimiter();
|
2010-03-04 19:20:28 +00:00
|
|
|
}
|
|
|
|
|
2019-02-22 13:51:25 +00:00
|
|
|
void IRowOutputStream::writeField(const IColumn &, const IDataType &, size_t)
|
|
|
|
{
|
|
|
|
throw Exception("Method writeField is not implemented for output format", ErrorCodes::NOT_IMPLEMENTED);
|
|
|
|
}
|
|
|
|
|
2010-03-04 19:20:28 +00:00
|
|
|
}
|