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

Method fuzzVector

src/Functions/fuzzQuery.cpp:113–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111
112private:
113 void fuzzVector(
114 const ColumnString::Chars & data,
115 const ColumnString::Offsets & offsets,
116 ColumnString & col_res,
117 size_t input_rows_count) const
118 {
119 size_t prev_offset = 0;
120 for (size_t i = 0; i < input_rows_count; ++i)
121 {
122 const char * begin = reinterpret_cast<const char *>(&data[prev_offset]);
123 const char * end = reinterpret_cast<const char *>(&data[offsets[i]]);
124
125 ParserQuery parser(end, false, implicit_select);
126 ASTPtr ast = parseQuery(parser, begin, end, "fuzzQuery", max_query_size, max_parser_depth, max_parser_backtracks);
127
128 ASTPtr fuzzed_ast;
129 {
130 auto [fuzzer, lock] = getGlobalASTFuzzer();
131 fuzzer->fuzzMain(ast);
132 }
133
134 WriteBufferFromOwnString buf;
135 ast->format(buf, IAST::FormatSettings(/*one_line=*/true));
136 col_res.insertData(buf.str().data(), buf.str().size());
137 prev_offset = offsets[i];
138 }
139 }
140
141 size_t max_query_size;
142 size_t max_parser_depth;

Callers

nothing calls this directly

Calls 9

parseQueryFunction · 0.85
getGlobalASTFuzzerFunction · 0.85
fuzzMainMethod · 0.80
FormatSettingsClass · 0.50
formatMethod · 0.45
insertDataMethod · 0.45
dataMethod · 0.45
strMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected