MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / clone

Method clone

src/Parsers/ASTExplainQuery.h:75–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73 String getID(char delim) const override { return "Explain" + (delim + toString(kind)); }
74 ExplainKind getKind() const { return kind; }
75 ASTPtr clone() const override
76 {
77 auto res = make_intrusive<ASTExplainQuery>(*this);
78
79 /// Re-add the named children explicitly, in the same order `ParserExplainQuery`
80 /// produces them, so that the clone has the same `getTreeHash` as a freshly parsed
81 /// AST. The parser parses the EXPLAIN-level settings before the explained query
82 /// (e.g. `EXPLAIN header = 1 SELECT 1` is parsed as `children = [ast_settings, query]`),
83 /// so `ast_settings` must come before `query`.
84 res->children.clear();
85 res->query = nullptr;
86 res->ast_settings = nullptr;
87 res->table_function = nullptr;
88 res->table_override = nullptr;
89
90 if (ast_settings)
91 res->setSettings(ast_settings->clone());
92 if (query)
93 res->setExplainedQuery(query->clone());
94 if (table_function)
95 res->setTableFunction(table_function->clone());
96 if (table_override)
97 res->setTableOverride(table_override->clone());
98
99 cloneOutputOptions(*res);
100 return res;
101 }
102
103 void setExplainKind(ExplainKind kind_) { kind = kind_; }
104

Callers

nothing calls this directly

Calls 5

setExplainedQueryMethod · 0.80
clearMethod · 0.45
setSettingsMethod · 0.45
setTableFunctionMethod · 0.45
setTableOverrideMethod · 0.45

Tested by

no test coverage detected