mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 18:12:02 +00:00
Merge pull request #53347 from amosbird/fix_52607
Fix incorrect normal projection AST format
This commit is contained in:
commit
f098b51283
@ -73,11 +73,11 @@ void ASTProjectionSelectQuery::formatImpl(const FormatSettings & s, FormatState
|
||||
|
||||
if (orderBy())
|
||||
{
|
||||
/// Let's convert the ASTFunction into ASTExpressionList, which generates consistent format
|
||||
/// Let's convert tuple ASTFunction into ASTExpressionList, which generates consistent format
|
||||
/// between GROUP BY and ORDER BY projection definition.
|
||||
s.ostr << (s.hilite ? hilite_keyword : "") << s.nl_or_ws << indent_str << "ORDER BY " << (s.hilite ? hilite_none : "");
|
||||
ASTPtr order_by;
|
||||
if (auto * func = orderBy()->as<ASTFunction>())
|
||||
if (auto * func = orderBy()->as<ASTFunction>(); func && func->name == "tuple")
|
||||
order_by = func->arguments;
|
||||
else
|
||||
{
|
||||
|
@ -0,0 +1 @@
|
||||
CREATE TABLE default.test\n(\n `uuid` FixedString(16),\n `id` Int32,\n `ns` FixedString(16),\n `dt` DateTime64(6),\n PROJECTION mtlog_proj_source_reference\n (\n SELECT *\n ORDER BY substring(ns, 1, 5)\n )\n)\nENGINE = MergeTree\nORDER BY (id, dt, uuid)\nSETTINGS index_granularity = 8192
|
17
tests/queries/0_stateless/01710_normal_projection_format.sql
Normal file
17
tests/queries/0_stateless/01710_normal_projection_format.sql
Normal file
@ -0,0 +1,17 @@
|
||||
DROP TABLE if exists test;
|
||||
|
||||
CREATE TABLE test
|
||||
(
|
||||
uuid FixedString(16),
|
||||
id int,
|
||||
ns FixedString(16),
|
||||
dt DateTime64(6),
|
||||
)
|
||||
ENGINE = MergeTree
|
||||
ORDER BY (id, dt, uuid);
|
||||
|
||||
ALTER TABLE test ADD PROJECTION mtlog_proj_source_reference (SELECT * ORDER BY substring(ns, 1, 5));
|
||||
|
||||
SHOW CREATE test;
|
||||
|
||||
drop table test;
|
Loading…
Reference in New Issue
Block a user