Skip to content

Commit 442d6a6

Browse files
Normalize the query in recoverLostReplica
1 parent 455e5a3 commit 442d6a6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Databases/DatabaseReplicated.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <Interpreters/DatabaseCatalog.h>
2525
#include <Interpreters/InterpreterCreateQuery.h>
2626
#include <Interpreters/InterpreterSetQuery.h>
27+
#include <Interpreters/NormalizeSelectWithUnionQueryVisitor.h>
2728
#include <Interpreters/ReplicatedDatabaseQueryStatusSource.h>
2829
#include <Interpreters/evaluateConstantExpression.h>
2930
#include <Interpreters/executeDDLQueryOnCluster.h>
@@ -66,6 +67,7 @@ namespace Setting
6667
extern const SettingsDistributedDDLOutputMode distributed_ddl_output_mode;
6768
extern const SettingsInt64 distributed_ddl_task_timeout;
6869
extern const SettingsBool throw_on_unsupported_query_inside_transaction;
70+
extern const SettingsSetOperationMode union_default_mode;
6971
}
7072

7173
namespace ServerSetting
@@ -1463,8 +1465,11 @@ void DatabaseReplicated::recoverLostReplica(const ZooKeeperPtr & current_zookeep
14631465
}
14641466

14651467
auto query_ast = parseQueryFromMetadataInZooKeeper(table_name, create_query_string);
1466-
14671468
auto create_query_context = make_query_context();
1469+
1470+
NormalizeSelectWithUnionQueryVisitor::Data data{create_query_context->getSettingsRef()[Setting::union_default_mode]};
1471+
NormalizeSelectWithUnionQueryVisitor{data}.visit(query_ast);
1472+
14681473
/// Check larger comment in DatabaseOnDisk::createTableFromAST
14691474
/// TL;DR applySettingsFromQuery will move the settings from engine to query level
14701475
/// making it possible to overcome a backward incompatible change.

0 commit comments

Comments
 (0)