mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
minor fixes
This commit is contained in:
parent
192409ebd2
commit
7b8a306e34
@ -65,7 +65,7 @@ void getAggregateFunctionNameAndParametersArray(
|
||||
ParserExpressionList params_parser(false);
|
||||
ASTPtr args_ast = parseQuery(params_parser,
|
||||
parameters_str.data(), parameters_str.data() + parameters_str.size(),
|
||||
"parameters of aggregate function in " + error_context);
|
||||
"parameters of aggregate function in " + error_context, 0);
|
||||
|
||||
ASTExpressionList & args_list = typeid_cast<ASTExpressionList &>(*args_ast);
|
||||
if (args_list.children.empty())
|
||||
|
@ -30,7 +30,7 @@ try
|
||||
readStringUntilEOF(query, in);
|
||||
|
||||
ParserSelectQuery parser;
|
||||
ASTPtr ast = parseQuery(parser, query.data(), query.data() + query.size(), "query");
|
||||
ASTPtr ast = parseQuery(parser, query.data(), query.data() + query.size(), "query", 0);
|
||||
|
||||
Context context = Context::createGlobal();
|
||||
|
||||
|
@ -23,7 +23,7 @@ try
|
||||
readStringUntilEOF(query, in);
|
||||
|
||||
ParserSelectQuery parser;
|
||||
ASTPtr ast = parseQuery(parser, query.data(), query.data() + query.size(), "query");
|
||||
ASTPtr ast = parseQuery(parser, query.data(), query.data() + query.size(), "query", 0);
|
||||
|
||||
AnalyzeLambdas analyzer;
|
||||
analyzer.process(ast);
|
||||
|
@ -26,7 +26,7 @@ try
|
||||
readStringUntilEOF(query, in);
|
||||
|
||||
ParserSelectQuery parser;
|
||||
ASTPtr ast = parseQuery(parser, query.data(), query.data() + query.size(), "query");
|
||||
ASTPtr ast = parseQuery(parser, query.data(), query.data() + query.size(), "query", 0);
|
||||
|
||||
Context context = Context::createGlobal();
|
||||
|
||||
|
@ -21,7 +21,7 @@ try
|
||||
readStringUntilEOF(query, in);
|
||||
|
||||
ParserSelectQuery parser;
|
||||
ASTPtr ast = parseQuery(parser, query.data(), query.data() + query.size(), "query");
|
||||
ASTPtr ast = parseQuery(parser, query.data(), query.data() + query.size(), "query", 0);
|
||||
|
||||
CollectAliases collector;
|
||||
collector.process(ast);
|
||||
|
@ -27,7 +27,7 @@ try
|
||||
readStringUntilEOF(query, in);
|
||||
|
||||
ParserSelectQuery parser;
|
||||
ASTPtr ast = parseQuery(parser, query.data(), query.data() + query.size(), "query");
|
||||
ASTPtr ast = parseQuery(parser, query.data(), query.data() + query.size(), "query", 0);
|
||||
|
||||
Context context = Context::createGlobal();
|
||||
|
||||
|
@ -33,7 +33,7 @@ try
|
||||
readStringUntilEOF(query, in);
|
||||
|
||||
ParserSelectQuery parser;
|
||||
ASTPtr ast = parseQuery(parser, query.data(), query.data() + query.size(), "query");
|
||||
ASTPtr ast = parseQuery(parser, query.data(), query.data() + query.size(), "query", 0);
|
||||
|
||||
Context context = Context::createGlobal();
|
||||
|
||||
|
@ -21,7 +21,7 @@ try
|
||||
readStringUntilEOF(query, in);
|
||||
|
||||
ParserSelectQuery parser;
|
||||
ASTPtr ast = parseQuery(parser, query.data(), query.data() + query.size(), "query");
|
||||
ASTPtr ast = parseQuery(parser, query.data(), query.data() + query.size(), "query", 0);
|
||||
|
||||
TranslatePositionalArguments translator;
|
||||
translator.process(ast);
|
||||
|
@ -38,7 +38,7 @@ try
|
||||
readStringUntilEOF(query, in);
|
||||
|
||||
ParserSelectQuery parser;
|
||||
ASTPtr ast = parseQuery(parser, query.data(), query.data() + query.size(), "query");
|
||||
ASTPtr ast = parseQuery(parser, query.data(), query.data() + query.size(), "query", 0);
|
||||
|
||||
Context context = Context::createGlobal();
|
||||
|
||||
|
@ -31,7 +31,7 @@ try
|
||||
std::string input = "SELECT number, number / 3, number * number";
|
||||
|
||||
ParserSelectQuery parser;
|
||||
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "");
|
||||
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "", 0);
|
||||
|
||||
Context context = Context::createGlobal();
|
||||
|
||||
|
@ -33,7 +33,7 @@ try
|
||||
std::string input = "SELECT number, number % 3 == 1";
|
||||
|
||||
ParserSelectQuery parser;
|
||||
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "");
|
||||
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "", 0);
|
||||
|
||||
formatAST(*ast, std::cerr);
|
||||
std::cerr << std::endl;
|
||||
|
@ -97,7 +97,7 @@ int main(int, char **)
|
||||
|
||||
std::string input = "SELECT UniqID, URL, CounterID, IsLink WHERE URL = 'http://mail.yandex.ru/neo2/#inbox'";
|
||||
ParserSelectQuery parser;
|
||||
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "");
|
||||
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "", 0);
|
||||
|
||||
formatAST(*ast, std::cerr);
|
||||
std::cerr << std::endl;
|
||||
|
@ -100,7 +100,7 @@ try
|
||||
|
||||
std::string input = "SELECT UniqID, URL, CounterID, IsLink";
|
||||
ParserSelectQuery parser;
|
||||
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "");
|
||||
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "", 0);
|
||||
|
||||
formatAST(*ast, std::cerr);
|
||||
std::cerr << std::endl;
|
||||
|
@ -24,7 +24,7 @@ namespace ErrorCodes
|
||||
DataTypePtr DataTypeFactory::get(const String & full_name) const
|
||||
{
|
||||
ParserIdentifierWithOptionalParameters parser;
|
||||
ASTPtr ast = parseQuery(parser, full_name.data(), full_name.data() + full_name.size(), "data type");
|
||||
ASTPtr ast = parseQuery(parser, full_name.data(), full_name.data() + full_name.size(), "data type", 0);
|
||||
return get(ast);
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@ static ASTPtr getCreateQueryImpl(const String & path, const String & table_name)
|
||||
}
|
||||
|
||||
ParserCreateQuery parser;
|
||||
return parseQuery(parser, query.data(), query.data() + query.size(), "in file " + table_metadata_path);
|
||||
return parseQuery(parser, query.data(), query.data() + query.size(), "in file " + table_metadata_path, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -479,7 +479,7 @@ void DatabaseOrdinary::alterTable(
|
||||
}
|
||||
|
||||
ParserCreateQuery parser;
|
||||
ASTPtr ast = parseQuery(parser, statement.data(), statement.data() + statement.size(), "in file " + table_metadata_path);
|
||||
ASTPtr ast = parseQuery(parser, statement.data(), statement.data() + statement.size(), "in file " + table_metadata_path, 0);
|
||||
|
||||
ASTCreateQuery & ast_create_query = typeid_cast<ASTCreateQuery &>(*ast);
|
||||
|
||||
|
@ -55,7 +55,7 @@ std::pair<String, StoragePtr> createTableFromDefinition(
|
||||
const String & description_for_error_message)
|
||||
{
|
||||
ParserCreateQuery parser;
|
||||
ASTPtr ast = parseQuery(parser, definition.data(), definition.data() + definition.size(), description_for_error_message);
|
||||
ASTPtr ast = parseQuery(parser, definition.data(), definition.data() + definition.size(), description_for_error_message, 0);
|
||||
|
||||
ASTCreateQuery & ast_create_query = typeid_cast<ASTCreateQuery &>(*ast);
|
||||
ast_create_query.attach = true;
|
||||
|
@ -424,7 +424,7 @@ void DDLWorker::parseQueryAndResolveHost(DDLTask & task)
|
||||
|
||||
ParserQuery parser_query(end);
|
||||
String description;
|
||||
task.query = parseQuery(parser_query, begin, end, description);
|
||||
task.query = parseQuery(parser_query, begin, end, description, 0);
|
||||
}
|
||||
|
||||
if (!task.query || !(task.query_on_cluster = dynamic_cast<ASTQueryWithOnCluster *>(task.query.get())))
|
||||
|
@ -293,7 +293,7 @@ ASTPtr InterpreterCreateQuery::formatColumns(const NamesAndTypesList & columns)
|
||||
const auto end = pos + type_name->size();
|
||||
|
||||
ParserIdentifierWithOptionalParameters storage_p;
|
||||
column_declaration->type = parseQuery(storage_p, pos, end, "data type");
|
||||
column_declaration->type = parseQuery(storage_p, pos, end, "data type", 0);
|
||||
column_declaration->type->owned_string = type_name;
|
||||
columns_list->children.emplace_back(column_declaration);
|
||||
}
|
||||
@ -317,7 +317,7 @@ ASTPtr InterpreterCreateQuery::formatColumns(const ColumnsDescription & columns)
|
||||
const auto end = pos + type_name->size();
|
||||
|
||||
ParserIdentifierWithOptionalParameters storage_p;
|
||||
column_declaration->type = parseQuery(storage_p, pos, end, "data type");
|
||||
column_declaration->type = parseQuery(storage_p, pos, end, "data type", 0);
|
||||
column_declaration->type->owned_string = type_name;
|
||||
|
||||
const auto it = columns.defaults.find(column.name);
|
||||
|
@ -331,7 +331,7 @@ void SystemLog<LogElement>::prepareTable()
|
||||
ParserStorage storage_parser;
|
||||
ASTPtr storage_ast = parseQuery(
|
||||
storage_parser, storage_def.data(), storage_def.data() + storage_def.size(),
|
||||
"Storage to create table for " + LogElement::name());
|
||||
"Storage to create table for " + LogElement::name(), 0);
|
||||
create->set(create->storage, storage_ast);
|
||||
|
||||
InterpreterCreateQuery interpreter(create, context);
|
||||
|
@ -35,7 +35,7 @@ static void executeCreateQuery(
|
||||
bool has_force_restore_data_flag)
|
||||
{
|
||||
ParserCreateQuery parser;
|
||||
ASTPtr ast = parseQuery(parser, query.data(), query.data() + query.size(), "in file " + file_name);
|
||||
ASTPtr ast = parseQuery(parser, query.data(), query.data() + query.size(), "in file " + file_name, 0);
|
||||
|
||||
ASTCreateQuery & ast_create_query = typeid_cast<ASTCreateQuery &>(*ast);
|
||||
ast_create_query.attach = true;
|
||||
|
@ -76,7 +76,7 @@ try
|
||||
") ENGINE = Log";
|
||||
|
||||
ParserCreateQuery parser;
|
||||
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "");
|
||||
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "", 0);
|
||||
|
||||
Context context = Context::createGlobal();
|
||||
|
||||
|
@ -41,7 +41,7 @@ int main(int argc, char ** argv)
|
||||
"s1 < s2 AND x % 3 < x % 5";
|
||||
|
||||
ParserSelectQuery parser;
|
||||
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "");
|
||||
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "", 0);
|
||||
|
||||
formatAST(*ast, std::cerr);
|
||||
std::cerr << std::endl;
|
||||
|
@ -1234,7 +1234,7 @@ bool parse(DB::ASTPtr & ast, const std::string & query)
|
||||
std::string message;
|
||||
auto begin = query.data();
|
||||
auto end = begin + query.size();
|
||||
ast = DB::tryParseQuery(parser, begin, end, message, false, "", false);
|
||||
ast = DB::tryParseQuery(parser, begin, end, message, false, "", false, 0);
|
||||
return ast != nullptr;
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ bool parse(DB::ASTPtr & ast, const std::string & query)
|
||||
std::string message;
|
||||
auto begin = query.data();
|
||||
auto end = begin + query.size();
|
||||
ast = DB::tryParseQuery(parser, begin, end, message, false, "", false);
|
||||
ast = DB::tryParseQuery(parser, begin, end, message, false, "", false, 0);
|
||||
return ast != nullptr;
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,7 @@ std::pair<const char *, bool> splitMultipartQuery(const std::string & queries, s
|
||||
{
|
||||
begin = pos;
|
||||
|
||||
ast = parseQueryAndMovePosition(parser, pos, end, "", true);
|
||||
ast = parseQueryAndMovePosition(parser, pos, end, "", true, 0);
|
||||
if (!ast)
|
||||
break;
|
||||
|
||||
|
@ -15,7 +15,8 @@ ASTPtr tryParseQuery(
|
||||
bool hilite,
|
||||
const std::string & description,
|
||||
bool allow_multi_statements, /// If false, check for non-space characters after semicolon and set error message if any.
|
||||
size_t max_query_size = 0);
|
||||
size_t max_query_size); /// If (end - pos) > max_query_size and query is longer than max_query_size then throws "Max query size exceeded".
|
||||
/// Disabled if zero. Is used in order to check query size if buffer can contains data for INSERT query.
|
||||
|
||||
|
||||
/// Parse query or throw an exception with error message.
|
||||
@ -25,7 +26,7 @@ ASTPtr parseQueryAndMovePosition(
|
||||
const char * end,
|
||||
const std::string & description,
|
||||
bool allow_multi_statements,
|
||||
size_t max_query_size = 0);
|
||||
size_t max_query_size);
|
||||
|
||||
|
||||
ASTPtr parseQuery(
|
||||
@ -33,7 +34,7 @@ ASTPtr parseQuery(
|
||||
const char * begin,
|
||||
const char * end,
|
||||
const std::string & description,
|
||||
size_t max_query_size = 0);
|
||||
size_t max_query_size);
|
||||
|
||||
ASTPtr parseQuery(
|
||||
IParser & parser,
|
||||
@ -44,7 +45,7 @@ ASTPtr parseQuery(
|
||||
ASTPtr parseQuery(
|
||||
IParser & parser,
|
||||
const std::string & query,
|
||||
size_t max_query_size = 0);
|
||||
size_t max_query_size);
|
||||
|
||||
|
||||
/** Split queries separated by ; on to list of single queries
|
||||
|
@ -12,7 +12,7 @@ int main(int, char **)
|
||||
|
||||
std::string input = "CREATE TABLE hits (URL String, UserAgentMinor2 FixedString(2), EventTime DateTime) ENGINE = Log";
|
||||
ParserCreateQuery parser;
|
||||
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "");
|
||||
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "", 0);
|
||||
|
||||
formatAST(*ast, std::cerr);
|
||||
std::cerr << std::endl;
|
||||
|
@ -23,7 +23,7 @@ try
|
||||
" FORMAT TabSeparated";
|
||||
|
||||
ParserQueryWithOutput parser;
|
||||
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "");
|
||||
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "", 0);
|
||||
|
||||
std::cout << "Success." << std::endl;
|
||||
formatAST(*ast, std::cerr);
|
||||
|
@ -778,7 +778,7 @@ private:
|
||||
if (is_interactive || ignore_error)
|
||||
{
|
||||
String message;
|
||||
res = tryParseQuery(parser, pos, end, message, true, "", allow_multi_statements);
|
||||
res = tryParseQuery(parser, pos, end, message, true, "", allow_multi_statements, 0);
|
||||
|
||||
if (!res)
|
||||
{
|
||||
@ -787,7 +787,7 @@ private:
|
||||
}
|
||||
}
|
||||
else
|
||||
res = parseQueryAndMovePosition(parser, pos, end, "", allow_multi_statements);
|
||||
res = parseQueryAndMovePosition(parser, pos, end, "", allow_multi_statements, 0);
|
||||
|
||||
if (is_interactive)
|
||||
{
|
||||
|
@ -544,14 +544,14 @@ TaskTable::TaskTable(TaskCluster & parent, const Poco::Util::AbstractConfigurati
|
||||
engine_push_str = config.getString(table_prefix + "engine");
|
||||
{
|
||||
ParserStorage parser_storage;
|
||||
engine_push_ast = parseQuery(parser_storage, engine_push_str);
|
||||
engine_push_ast = parseQuery(parser_storage, engine_push_str, 0);
|
||||
engine_push_partition_key_ast = extractPartitionKey(engine_push_ast);
|
||||
}
|
||||
|
||||
sharding_key_str = config.getString(table_prefix + "sharding_key");
|
||||
{
|
||||
ParserExpressionWithOptionalAlias parser_expression(false);
|
||||
sharding_key_ast = parseQuery(parser_expression, sharding_key_str);
|
||||
sharding_key_ast = parseQuery(parser_expression, sharding_key_str, 0);
|
||||
engine_split_ast = createASTStorageDistributed(cluster_push_name, table_push.first, table_push.second, sharding_key_ast);
|
||||
}
|
||||
|
||||
@ -559,7 +559,7 @@ TaskTable::TaskTable(TaskCluster & parent, const Poco::Util::AbstractConfigurati
|
||||
if (!where_condition_str.empty())
|
||||
{
|
||||
ParserExpressionWithOptionalAlias parser_expression(false);
|
||||
where_condition_ast = parseQuery(parser_expression, where_condition_str);
|
||||
where_condition_ast = parseQuery(parser_expression, where_condition_str, 0);
|
||||
|
||||
// Will use canonical expression form
|
||||
where_condition_str = queryToString(where_condition_ast);
|
||||
@ -1476,7 +1476,7 @@ protected:
|
||||
query += " LIMIT " + limit;
|
||||
|
||||
ParserQuery p_query(query.data() + query.size());
|
||||
return parseQuery(p_query, query);
|
||||
return parseQuery(p_query, query, 0);
|
||||
};
|
||||
|
||||
/// Load balancing
|
||||
@ -1629,7 +1629,7 @@ protected:
|
||||
query += "INSERT INTO " + getDatabaseDotTable(task_shard.table_split_shard) + " VALUES ";
|
||||
|
||||
ParserQuery p_query(query.data() + query.size());
|
||||
query_insert_ast = parseQuery(p_query, query);
|
||||
query_insert_ast = parseQuery(p_query, query, 0);
|
||||
|
||||
LOG_DEBUG(log, "Executing INSERT query: " << query);
|
||||
}
|
||||
@ -1780,7 +1780,7 @@ protected:
|
||||
&task_cluster->settings_pull);
|
||||
|
||||
ParserCreateQuery parser_create_query;
|
||||
return parseQuery(parser_create_query, create_query_pull_str);
|
||||
return parseQuery(parser_create_query, create_query_pull_str, 0);
|
||||
}
|
||||
|
||||
void createShardInternalTables(TaskShard & task_shard, bool create_split = true)
|
||||
@ -1831,7 +1831,7 @@ protected:
|
||||
}
|
||||
|
||||
ParserQuery parser_query(query.data() + query.size());
|
||||
ASTPtr query_ast = parseQuery(parser_query, query);
|
||||
ASTPtr query_ast = parseQuery(parser_query, query, 0);
|
||||
|
||||
LOG_DEBUG(log, "Computing destination partition set, executing query: " << query);
|
||||
|
||||
@ -1878,7 +1878,7 @@ protected:
|
||||
<< partition_quoted_name << " existence, executing query: " << query);
|
||||
|
||||
ParserQuery parser_query(query.data() + query.size());
|
||||
ASTPtr query_ast = parseQuery(parser_query, query);
|
||||
ASTPtr query_ast = parseQuery(parser_query, query, 0);
|
||||
|
||||
Context local_context = context;
|
||||
local_context.setSettings(task_cluster->settings_pull);
|
||||
@ -1903,7 +1903,7 @@ protected:
|
||||
if (query_ast_ == nullptr)
|
||||
{
|
||||
ParserQuery p_query(query.data() + query.size());
|
||||
query_ast = parseQuery(p_query, query);
|
||||
query_ast = parseQuery(p_query, query, 0);
|
||||
}
|
||||
else
|
||||
query_ast = query_ast_;
|
||||
|
@ -50,7 +50,7 @@ int mainEntryClickHouseFormat(int argc, char ** argv)
|
||||
const char * end = pos + query.size();
|
||||
|
||||
ParserQuery parser(end);
|
||||
ASTPtr res = parseQuery(parser, pos, end, "query");
|
||||
ASTPtr res = parseQuery(parser, pos, end, "query", 0);
|
||||
|
||||
if (!quiet)
|
||||
{
|
||||
|
@ -145,7 +145,7 @@ ColumnsDescription ColumnsDescription::parse(const String & str)
|
||||
|
||||
const char * begin = default_expr_str.data();
|
||||
const auto end = begin + default_expr_str.size();
|
||||
ASTPtr default_expr = parseQuery(expr_parser, begin, end, "default expression");
|
||||
ASTPtr default_expr = parseQuery(expr_parser, begin, end, "default expression", 0);
|
||||
|
||||
if (ColumnDefaultKind::Default == default_kind)
|
||||
result.ordinary.emplace_back(column_name, std::move(type));
|
||||
|
@ -129,7 +129,7 @@ MergeTreeData::MergeTreeData(
|
||||
String partition_expr_str = "toYYYYMM(" + backQuoteIfNeed(date_column_name) + ")";
|
||||
ParserNotEmptyExpressionList parser(/* allow_alias_without_as_keyword = */ false);
|
||||
partition_expr_ast = parseQuery(
|
||||
parser, partition_expr_str.data(), partition_expr_str.data() + partition_expr_str.length(), "partition expression");
|
||||
parser, partition_expr_str.data(), partition_expr_str.data() + partition_expr_str.length(), "partition expression", 0);
|
||||
|
||||
initPartitionKey();
|
||||
|
||||
|
@ -66,7 +66,7 @@ ColumnsDescription getStructureOfRemoteTable(
|
||||
auto kind = columnDefaultKindFromString(kind_name);
|
||||
|
||||
String expr_str = (*default_expr)[i].get<const String &>();
|
||||
ASTPtr expr = parseQuery(expr_parser, expr_str.data(), expr_str.data() + expr_str.size(), "default expression");
|
||||
ASTPtr expr = parseQuery(expr_parser, expr_str.data(), expr_str.data() + expr_str.size(), "default expression", 0);
|
||||
res.defaults.emplace(column_name, ColumnDefault{kind, expr});
|
||||
|
||||
if (ColumnDefaultKind::Default == kind)
|
||||
|
Loading…
Reference in New Issue
Block a user