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

Method fuzzMain

src/Common/QueryFuzzer.cpp:5638–5668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5636}
5637
5638void QueryFuzzer::fuzzMain(ASTPtr & ast)
5639{
5640 current_ast_depth = 0;
5641 iteration_count = 0;
5642 debug_visited_nodes.clear();
5643 debug_top_ast = *
5644 last_query_parameters.clear();
5645 param_counter = 0;
5646
5647 collectFuzzInfoMain(ast);
5648 fuzz(ast);
5649
5650 /// Pick up any {name:type} params introduced during fuzzing (e.g. substituted from the
5651 /// column_like pool). Use try_emplace so values seeded above are not overwritten.
5652 std::function<void(const ASTPtr &)> seed_new_params = [&](const ASTPtr & node)
5653 {
5654 if (const auto * p = typeid_cast<const ASTQueryParameter *>(node.get()))
5655 last_query_parameters.try_emplace(p->name, generateParamValue());
5656 for (const auto & child : node->children)
5657 seed_new_params(child);
5658 };
5659 seed_new_params(ast);
5660
5661 CurrentMetrics::set(CurrentMetrics::ASTFuzzerAccumulatedFragments, getAccumulatedStateSize());
5662
5663 if (out_stream)
5664 {
5665 *out_stream << std::endl;
5666 *out_stream << ast->formatWithSecretsOneLine() << std::endl << std::endl;
5667 }
5668}
5669
5670}

Callers 5

processWithASTFuzzerMethod · 0.80
createColumnMethod · 0.80
executeASTFuzzerQueriesFunction · 0.80
executeImplMethod · 0.80
fuzzVectorMethod · 0.80

Calls 4

setFunction · 0.70
clearMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected