From f755e775349ac10207378e0774c4b76559fbd7c8 Mon Sep 17 00:00:00 2001 From: Duc Canh Le Date: Sun, 14 Jan 2024 09:36:32 +0000 Subject: [PATCH] move column level setting to the end of declaration Signed-off-by: Duc Canh Le --- src/Interpreters/InterpreterCreateQuery.cpp | 16 ++++++++-------- src/Parsers/ASTColumnDeclaration.cpp | 12 ++++++------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Interpreters/InterpreterCreateQuery.cpp b/src/Interpreters/InterpreterCreateQuery.cpp index 01eedca2184..f3ef1e3359e 100644 --- a/src/Interpreters/InterpreterCreateQuery.cpp +++ b/src/Interpreters/InterpreterCreateQuery.cpp @@ -453,14 +453,6 @@ ASTPtr InterpreterCreateQuery::formatColumns(const ColumnsDescription & columns) column_declaration->children.push_back(column_declaration->codec); } - if (!column.settings.empty()) - { - auto per_column_settings = std::make_shared(); - per_column_settings->is_standalone = false; - per_column_settings->changes = column.settings; - column_declaration->per_column_settings = std::move(per_column_settings); - } - if (column.stat) { column_declaration->stat_type = column.stat->ast; @@ -473,6 +465,14 @@ ASTPtr InterpreterCreateQuery::formatColumns(const ColumnsDescription & columns) column_declaration->children.push_back(column_declaration->ttl); } + if (!column.settings.empty()) + { + auto per_column_settings = std::make_shared(); + per_column_settings->is_standalone = false; + per_column_settings->changes = column.settings; + column_declaration->per_column_settings = std::move(per_column_settings); + } + columns_list->children.push_back(column_declaration_ptr); } diff --git a/src/Parsers/ASTColumnDeclaration.cpp b/src/Parsers/ASTColumnDeclaration.cpp index 196780ccf29..dd3bf6ae8d8 100644 --- a/src/Parsers/ASTColumnDeclaration.cpp +++ b/src/Parsers/ASTColumnDeclaration.cpp @@ -39,12 +39,6 @@ ASTPtr ASTColumnDeclaration::clone() const res->children.push_back(res->codec); } - if (per_column_settings) - { - res->per_column_settings = per_column_settings->clone(); - res->children.push_back(res->per_column_settings); - } - if (stat_type) { res->stat_type = stat_type->clone(); @@ -63,6 +57,12 @@ ASTPtr ASTColumnDeclaration::clone() const res->children.push_back(res->collation); } + if (per_column_settings) + { + res->per_column_settings = per_column_settings->clone(); + res->children.push_back(res->per_column_settings); + } + return res; }