mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
62 lines
1.3 KiB
C++
62 lines
1.3 KiB
C++
#include <Processors/Formats/LazyOutputFormat.h>
|
|
#include <Processors/Transforms/AggregatingTransform.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
WriteBuffer LazyOutputFormat::out(nullptr, 0);
|
|
|
|
Block LazyOutputFormat::getBlock(UInt64 milliseconds)
|
|
{
|
|
if (finished_processing)
|
|
{
|
|
if (queue.empty())
|
|
return {};
|
|
}
|
|
|
|
Chunk chunk;
|
|
if (!queue.tryPop(chunk, milliseconds))
|
|
return {};
|
|
|
|
if (!chunk)
|
|
return {};
|
|
|
|
auto block = getPort(PortKind::Main).getHeader().cloneWithColumns(chunk.detachColumns());
|
|
info.update(block);
|
|
|
|
if (auto chunk_info = chunk.getChunkInfo())
|
|
{
|
|
if (auto * agg_info = typeid_cast<const AggregatedChunkInfo *>(chunk_info.get()))
|
|
{
|
|
block.info.bucket_num = agg_info->bucket_num;
|
|
block.info.is_overflows = agg_info->is_overflows;
|
|
}
|
|
}
|
|
|
|
return block;
|
|
}
|
|
|
|
Block LazyOutputFormat::getTotals()
|
|
{
|
|
if (!totals)
|
|
return {};
|
|
|
|
return getPort(PortKind::Totals).getHeader().cloneWithColumns(totals.detachColumns());
|
|
}
|
|
|
|
Block LazyOutputFormat::getExtremes()
|
|
{
|
|
if (!extremes)
|
|
return {};
|
|
|
|
return getPort(PortKind::Extremes).getHeader().cloneWithColumns(extremes.detachColumns());
|
|
}
|
|
|
|
void LazyOutputFormat::setRowsBeforeLimit(size_t rows_before_limit)
|
|
{
|
|
info.setRowsBeforeLimit(rows_before_limit);
|
|
}
|
|
|
|
}
|