Skip to content

Commit

Permalink
Backport #57906 to 23.9: Normalize function names in CREATE INDEX
Browse files Browse the repository at this point in the history
  • Loading branch information
robot-clickhouse committed Dec 20, 2023
1 parent 0a0d396 commit 77b1632
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Interpreters/InterpreterCreateFunctionQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <Interpreters/Context.h>
#include <Interpreters/executeDDLQueryOnCluster.h>
#include <Interpreters/removeOnClusterClauseIfNeeded.h>
#include <Interpreters/FunctionNameNormalizer.h>
#include <Parsers/ASTCreateFunctionQuery.h>


Expand All @@ -19,6 +20,7 @@ namespace ErrorCodes

BlockIO InterpreterCreateFunctionQuery::execute()
{
FunctionNameNormalizer().visit(query_ptr.get());
const auto updated_query_ptr = removeOnClusterClauseIfNeeded(query_ptr, getContext());
ASTCreateFunctionQuery & create_function_query = updated_query_ptr->as<ASTCreateFunctionQuery &>();

Expand Down
2 changes: 2 additions & 0 deletions src/Interpreters/InterpreterCreateIndexQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <Databases/DatabaseReplicated.h>
#include <Interpreters/Context.h>
#include <Interpreters/executeDDLQueryOnCluster.h>
#include <Interpreters/FunctionNameNormalizer.h>
#include <Parsers/ASTCreateIndexQuery.h>
#include <Parsers/ASTIdentifier.h>
#include <Parsers/ASTIndexDeclaration.h>
Expand All @@ -22,6 +23,7 @@ namespace ErrorCodes

BlockIO InterpreterCreateIndexQuery::execute()
{
FunctionNameNormalizer().visit(query_ptr.get());
auto current_context = getContext();
const auto & create_index = query_ptr->as<ASTCreateIndexQuery &>();

Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

create table rmt (n int, ts DateTime64(8, 'UTC')) engine=ReplicatedMergeTree('/test/02487/{database}/rmt', '1') order by n;
alter table rmt add index idx1 date(ts) TYPE MinMax GRANULARITY 1;
create index idx2 on rmt date(ts) TYPE MinMax GRANULARITY 1;
system restart replica rmt;
create table rmt2 (n int, ts DateTime64(8, 'UTC'), index idx1 date(ts) TYPE MinMax GRANULARITY 1, index idx2 date(ts) TYPE MinMax GRANULARITY 1) engine=ReplicatedMergeTree('/test/02487/{database}/rmt', '2') order by n;

0 comments on commit 77b1632

Please sign in to comment.