move column level setting to the end of declaration

Signed-off-by: Duc Canh Le <duccanh.le@ahrefs.com>
This commit is contained in:
Duc Canh Le 2024-01-14 09:36:32 +00:00
parent ac76eecb1e
commit f755e77534
2 changed files with 14 additions and 14 deletions

View File

@ -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<ASTSetQuery>();
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<ASTSetQuery>();
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);
}

View File

@ -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;
}