mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-13 01:41:59 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
37 lines
854 B
C++
37 lines
854 B
C++
#include <DataStreams/SquashingBlockInputStream.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
SquashingBlockInputStream::SquashingBlockInputStream(
|
|
const BlockInputStreamPtr & src, size_t min_block_size_rows, size_t min_block_size_bytes, bool reserve_memory)
|
|
: header(src->getHeader()), transform(min_block_size_rows, min_block_size_bytes, reserve_memory)
|
|
{
|
|
children.emplace_back(src);
|
|
}
|
|
|
|
|
|
Block SquashingBlockInputStream::readImpl()
|
|
{
|
|
if (all_read)
|
|
return {};
|
|
|
|
while (true)
|
|
{
|
|
Block block = children[0]->read();
|
|
if (!block)
|
|
all_read = true;
|
|
|
|
SquashingTransform::Result result = transform.add(block.mutateColumns());
|
|
if (result.ready)
|
|
{
|
|
if (result.columns.empty())
|
|
return {};
|
|
return header.cloneWithColumns(std::move(result.columns));
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|