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

Method clone

src/Parsers/ASTSelectQuery.cpp:49–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47
48
49ASTPtr ASTSelectQuery::clone() const
50{
51 auto res = std::make_shared<ASTSelectQuery>(*this);
52 res->children.clear();
53 res->positions.clear();
54
55#define CLONE(expr) res->setExpression(expr, getExpression(expr, true))
56
57 /** NOTE Members must clone exactly in the same order,
58 * in which they were inserted into `children` in ParserSelectQuery.
59 * This is important because of the children's names the identifier (getTreeHash) is compiled,
60 * which can be used for column identifiers in the case of subqueries in the IN statement.
61 * For distributed query processing, in case one of the servers is localhost and the other one is not,
62 * localhost query is executed within the process and is cloned,
63 * and the request is sent to the remote server in text form via TCP.
64 * And if the cloning order does not match the parsing order,
65 * then different servers will get different identifiers.
66 */
67 CLONE(Expression::WITH);
68 CLONE(Expression::SELECT);
69 CLONE(Expression::TABLES);
70 CLONE(Expression::PREWHERE);
71 CLONE(Expression::WHERE);
72 CLONE(Expression::GROUP_BY);
73 CLONE(Expression::HAVING);
74 CLONE(Expression::WINDOW);
75 CLONE(Expression::ORDER_BY);
76 CLONE(Expression::LIMIT_BY_OFFSET);
77 CLONE(Expression::LIMIT_BY_LENGTH);
78 CLONE(Expression::LIMIT_BY);
79 CLONE(Expression::LIMIT_OFFSET);
80 CLONE(Expression::LIMIT_LENGTH);
81 CLONE(Expression::SETTINGS);
82
83#undef CLONE
84
85 return res;
86}
87
88void ASTSelectQuery::collectAllTables(const IAST * ast, std::vector<ASTPtr>& all_tables, bool & has_table_functions)
89{

Callers 1

addTableFunctionMethod · 0.45

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected