mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-01 03:52:15 +00:00
Fix totals with rollup.
This commit is contained in:
parent
4d87fd327f
commit
0b8107c497
@ -1637,8 +1637,12 @@ void InterpreterSelectQuery::executeHaving(Pipeline & pipeline, const Expression
|
||||
|
||||
void InterpreterSelectQuery::executeHaving(QueryPipeline & pipeline, const ExpressionActionsPtr & expression)
|
||||
{
|
||||
pipeline.addSimpleTransform([&](const Block & header)
|
||||
pipeline.addSimpleTransform([&](const Block & header, QueryPipeline::StreamType stream_type) -> ProcessorPtr
|
||||
{
|
||||
if (stream_type == QueryPipeline::StreamType::Totals)
|
||||
return nullptr;
|
||||
|
||||
/// TODO: do we need to save filter there?
|
||||
return std::make_shared<FilterTransform>(header, expression, getSelectQuery().having_expression->getColumnName(), false);
|
||||
});
|
||||
}
|
||||
@ -1731,7 +1735,7 @@ void InterpreterSelectQuery::executeRollupOrCube(QueryPipeline & pipeline, Modif
|
||||
|
||||
pipeline.addSimpleTransform([&](const Block & header, QueryPipeline::StreamType stream_type) -> ProcessorPtr
|
||||
{
|
||||
if (stream_type != QueryPipeline::StreamType::Main)
|
||||
if (stream_type == QueryPipeline::StreamType::Totals)
|
||||
return nullptr;
|
||||
|
||||
if (modificator == Modificator::ROLLUP)
|
||||
|
@ -58,7 +58,7 @@ TotalsHavingTransform::TotalsHavingTransform(
|
||||
finalizeBlock(finalized_header);
|
||||
|
||||
/// Port for Totals.
|
||||
outputs.emplace_back(outputs.front().getHeader(), this);
|
||||
outputs.emplace_back(finalized_header, this);
|
||||
|
||||
/// Initialize current totals with initial state.
|
||||
current_totals.reserve(header.columns());
|
||||
@ -258,12 +258,12 @@ void TotalsHavingTransform::prepareTotals()
|
||||
totals = Chunk(std::move(current_totals), 1);
|
||||
finalizeChunk(totals);
|
||||
|
||||
if (expression)
|
||||
{
|
||||
auto block = finalized_header.cloneWithColumns(totals.detachColumns());
|
||||
expression->execute(block);
|
||||
totals = Chunk(block.getColumns(), 1);
|
||||
}
|
||||
// if (expression)
|
||||
// {
|
||||
// auto block = finalized_header.cloneWithColumns(totals.detachColumns());
|
||||
// expression->execute(block);
|
||||
// totals = Chunk(block.getColumns(), 1);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user