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

Function queryHasWithClause

programs/client/Client.cpp:158–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156
157
158static bool queryHasWithClause(const IAST * ast)
159{
160 if (const auto * select = dynamic_cast<const ASTSelectQuery *>(ast); select && select->with())
161 {
162 return true;
163 }
164
165 // This full recursive walk is somewhat excessive, because most of the
166 // children are not queries, but on the other hand it will let us to avoid
167 // breakage when the AST structure changes and some new variant of query
168 // nesting is added. This function is used in fuzzer, so it's better to be
169 // defensive and avoid weird unexpected errors.
170 // clang-tidy is confused by this function: it thinks that if `select` is
171 // nullptr, `ast` is also nullptr, and complains about nullptr dereference.
172 // NOLINTNEXTLINE
173 for (const auto & child : ast->children)
174 {
175 if (queryHasWithClause(child.get()))
176 {
177 return true;
178 }
179 }
180
181 return false;
182}
183
184
185class Client : public Poco::Util::Application

Callers 1

processWithFuzzingMethod · 0.85

Calls 2

withMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected