| 67 | } |
| 68 | |
| 69 | ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr &, size_t input_rows_count) const override |
| 70 | { |
| 71 | const ColumnPtr col_query = arguments[0].column; |
| 72 | |
| 73 | if (const ColumnString * col_query_string = checkAndGetColumn<ColumnString>(col_query.get())) |
| 74 | { |
| 75 | auto col_res = ColumnString::create(); |
| 76 | fuzzVector( |
| 77 | col_query_string->getChars(), col_query_string->getOffsets(), |
| 78 | *col_res, |
| 79 | input_rows_count); |
| 80 | return col_res; |
| 81 | } |
| 82 | |
| 83 | if (const ColumnConst * col_query_const = checkAndGetColumnConstStringOrFixedString(col_query.get())) |
| 84 | { |
| 85 | auto col_res = ColumnString::create(); |
| 86 | |
| 87 | const ColumnString::Chars & data = assert_cast<const ColumnString &>(col_query_const->getDataColumn()).getChars(); |
| 88 | const char * begin = reinterpret_cast<const char *>(data.data()); |
| 89 | const char * end = begin + data.size(); |
| 90 | ParserQuery parser(end, false, implicit_select); |
| 91 | ASTPtr ast = parseQuery(parser, begin, end, "fuzzQuery", max_query_size, max_parser_depth, max_parser_backtracks); |
| 92 | |
| 93 | for (size_t i = 0; i < input_rows_count; ++i) |
| 94 | { |
| 95 | ASTPtr fuzzed_ast = ast->clone(); |
| 96 | { |
| 97 | auto [fuzzer, lock] = getGlobalASTFuzzer(); |
| 98 | fuzzer->fuzzMain(fuzzed_ast); |
| 99 | } |
| 100 | |
| 101 | WriteBufferFromOwnString buf; |
| 102 | fuzzed_ast->format(buf, IAST::FormatSettings(/*one_line=*/true)); |
| 103 | col_res->insertData(buf.str().data(), buf.str().size()); |
| 104 | } |
| 105 | |
| 106 | return col_res; |
| 107 | } |
| 108 | |
| 109 | throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Illegal column {} of argument of function {}", col_query->getName(), getName()); |
| 110 | } |
| 111 | |
| 112 | private: |
| 113 | void fuzzVector( |
nothing calls this directly
no test coverage detected