From f4643b83410b7efd5dfc175fffe40cba0bfb0e72 Mon Sep 17 00:00:00 2001 From: Igor Nikonov Date: Wed, 21 Feb 2024 14:13:27 +0000 Subject: [PATCH 1/2] Fix: RENAME AST clone + minor cleanup --- src/Parsers/ASTRenameQuery.h | 10 ++++++++++ src/Processors/Executors/PipelineExecutor.h | 1 - src/Server/HTTP/WriteBufferFromHTTPServerResponse.h | 1 - src/Server/HTTPHandler.h | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Parsers/ASTRenameQuery.h b/src/Parsers/ASTRenameQuery.h index 5d07cb976af..5fce056d7dd 100644 --- a/src/Parsers/ASTRenameQuery.h +++ b/src/Parsers/ASTRenameQuery.h @@ -35,6 +35,11 @@ public: tryGetIdentifierNameInto(table, name); return name; } + + Table clone() const + { + return Table{.database = database->clone(), .table = table->clone()}; + } }; struct Element @@ -61,6 +66,11 @@ public: { auto res = std::make_shared(*this); cloneOutputOptions(*res); + for(auto & element : res->elements) + { + element.from = element.from.clone(); + element.to = element.to.clone(); + } return res; } diff --git a/src/Processors/Executors/PipelineExecutor.h b/src/Processors/Executors/PipelineExecutor.h index 862a460f0ed..cb840a2e3fb 100644 --- a/src/Processors/Executors/PipelineExecutor.h +++ b/src/Processors/Executors/PipelineExecutor.h @@ -7,7 +7,6 @@ #include #include -#include #include diff --git a/src/Server/HTTP/WriteBufferFromHTTPServerResponse.h b/src/Server/HTTP/WriteBufferFromHTTPServerResponse.h index a3952b7c553..b344d50944a 100644 --- a/src/Server/HTTP/WriteBufferFromHTTPServerResponse.h +++ b/src/Server/HTTP/WriteBufferFromHTTPServerResponse.h @@ -11,7 +11,6 @@ #include #include -#include namespace DB diff --git a/src/Server/HTTPHandler.h b/src/Server/HTTPHandler.h index fa2d0dae199..689b0c92dfb 100644 --- a/src/Server/HTTPHandler.h +++ b/src/Server/HTTPHandler.h @@ -32,7 +32,7 @@ class HTTPHandler : public HTTPRequestHandler { public: HTTPHandler(IServer & server_, const std::string & name, const std::optional & content_type_override_); - virtual ~HTTPHandler() override; + ~HTTPHandler() override; void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event & write_event) override; From 7411e81bec1cc4c324d09f79423b9e030107a702 Mon Sep 17 00:00:00 2001 From: Igor Nikonov Date: Wed, 21 Feb 2024 15:00:25 +0000 Subject: [PATCH 2/2] Fix style --- src/Parsers/ASTRenameQuery.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Parsers/ASTRenameQuery.h b/src/Parsers/ASTRenameQuery.h index 5fce056d7dd..e34aa8e6513 100644 --- a/src/Parsers/ASTRenameQuery.h +++ b/src/Parsers/ASTRenameQuery.h @@ -66,7 +66,7 @@ public: { auto res = std::make_shared(*this); cloneOutputOptions(*res); - for(auto & element : res->elements) + for (auto & element : res->elements) { element.from = element.from.clone(); element.to = element.to.clone();