mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 16:50:48 +00:00
add rollup to formatted query
This commit is contained in:
parent
0ad5793681
commit
472adf4ab9
@ -28,7 +28,7 @@ RollupBlockInputStream::RollupBlockInputStream(
|
||||
keys(params_.keys)
|
||||
{
|
||||
children.push_back(input_);
|
||||
Aggregator::CancellationHook hook = [&]() { return this->isCancelled(); };
|
||||
Aggregator::CancellationHook hook = [this]() { return this->isCancelled(); };
|
||||
aggregator.setCancellationHook(hook);
|
||||
}
|
||||
|
||||
@ -57,12 +57,12 @@ Block RollupBlockInputStream::readImpl()
|
||||
return finalized;
|
||||
}
|
||||
|
||||
current_block = children[0]->read();
|
||||
Block block = children[0]->read();
|
||||
current_key = keys.size() - 1;
|
||||
|
||||
rollup_block = current_block;
|
||||
finalize(current_block);
|
||||
rollup_block = block;
|
||||
finalize(block);
|
||||
|
||||
return current_block;
|
||||
return block;
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,6 @@ private:
|
||||
Aggregator aggregator;
|
||||
ColumnNumbers keys;
|
||||
ssize_t current_key = -1;
|
||||
Block current_block;
|
||||
Block rollup_block;
|
||||
};
|
||||
|
||||
|
@ -706,7 +706,7 @@ void InterpreterSelectQuery::executeFetchColumns(
|
||||
max_streams = settings.max_distributed_connections;
|
||||
}
|
||||
|
||||
size_t max_block_size = settings.max_block_size;
|
||||
size_t max_block_size = settings.max_block_size;
|
||||
|
||||
if (!max_block_size)
|
||||
throw Exception("Setting 'max_block_size' cannot be zero", ErrorCodes::PARAMETER_OUT_OF_BOUND);
|
||||
|
@ -103,6 +103,9 @@ void ASTSelectQuery::formatImpl(const FormatSettings & s, FormatState & state, F
|
||||
: typeid_cast<const ASTExpressionList &>(*group_expression_list).formatImplMultiline(s, state, frame);
|
||||
}
|
||||
|
||||
if (group_by_with_rollup)
|
||||
s.ostr << (s.hilite ? hilite_keyword : "") << s.nl_or_ws << indent_str << (s.one_line ? "" : " ") << "WITH ROLLUP" << (s.hilite ? hilite_none : "");
|
||||
|
||||
if (group_by_with_totals)
|
||||
s.ostr << (s.hilite ? hilite_keyword : "") << s.nl_or_ws << indent_str << (s.one_line ? "" : " ") << "WITH TOTALS" << (s.hilite ? hilite_none : "");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user