Do not fuzz CREATE queries

We don't do it anyway, the first unmodified query succeeds and all
others fail. Just make it official.
This commit is contained in:
Alexander Kuzmenkov 2020-08-06 18:39:09 +03:00
parent 25a472a306
commit c32fddbb6d
1 changed files with 16 additions and 3 deletions

View File

@ -57,7 +57,7 @@
#include <DataStreams/AsynchronousBlockInputStream.h>
#include <DataStreams/AddingDefaultsBlockInputStream.h>
#include <DataStreams/InternalTextLogsRowOutputStream.h>
#include <Parsers/ParserQuery.h>
#include <Parsers/ASTCreateQuery.h>
#include <Parsers/ASTSetQuery.h>
#include <Parsers/ASTUseQuery.h>
#include <Parsers/ASTInsertQuery.h>
@ -67,6 +67,7 @@
#include <Parsers/ASTIdentifier.h>
#include <Parsers/formatAST.h>
#include <Parsers/parseQuery.h>
#include <Parsers/ParserQuery.h>
#include <Interpreters/Context.h>
#include <Interpreters/InterpreterSetQuery.h>
#include <Interpreters/ReplaceQueryParameterVisitor.h>
@ -1040,9 +1041,21 @@ private:
full_query = text.substr(this_query_begin - text.data(),
begin - text.data());
// Don't repeat inserts, the tables grow too big. Also don't repeat
// creates because first we run the unmodified query, it will succeed,
// and the subsequent queries will fail. When we run out of fuzzer
// errors, it may be interesting to add fuzzing of create queries that
// wraps columns into LowCardinality or Nullable. Also there are other
// kinds of create queries such as CREATE DICTIONARY, we could fuzz
// them as well.
int this_query_runs = query_fuzzer_runs;
if (as_insert
|| orig_ast->as<ASTCreateQuery>())
{
this_query_runs = 1;
}
ASTPtr fuzz_base = orig_ast;
// Don't repeat inserts, the tables grow too big.
const int this_query_runs = as_insert ? 1 : query_fuzzer_runs;
for (int fuzz_step = 0; fuzz_step < this_query_runs; fuzz_step++)
{
fprintf(stderr, "fuzzing step %d out of %d for query at pos %zd\n",