ClickHouse/dbms/src/DataStreams/copyData.cpp

43 lines
793 B
C++
Raw Normal View History

2010-03-04 19:20:28 +00:00
#include <DB/DataStreams/RowInputStreamFromBlockInputStream.h>
2010-05-24 17:55:57 +00:00
#include <DB/DataStreams/BlockInputStreamFromRowInputStream.h>
2010-03-04 19:20:28 +00:00
#include <DB/DataStreams/copyData.h>
namespace DB
{
void copyData(IBlockInputStream & from, IBlockOutputStream & to)
{
while (Block block = from.read())
to.write(block);
}
void copyData(IRowInputStream & from, IRowOutputStream & to)
{
while (1)
{
Row row = from.read();
if (row.empty())
break;
to.write(row);
}
}
void copyData(IBlockInputStream & from, IRowOutputStream & to)
{
RowInputStreamFromBlockInputStream row_input(from);
copyData(row_input, to);
}
2010-05-24 17:55:57 +00:00
void copyData(IRowInputStream & from, IBlockOutputStream & to, const Block & sample)
{
BlockInputStreamFromRowInputStream block_input(from, sample);
copyData(block_input, to);
}
2010-03-04 19:20:28 +00:00
}