Fix tests

This commit is contained in:
Kruglov Pavel 2022-02-15 14:57:38 +03:00 committed by GitHub
parent a8f83a387c
commit 5353981500
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,19 +86,20 @@ void TableFunctionS3::parseArguments(const ASTPtr & ast_function, ContextPtr con
/// We can distinguish them by looking at the 2-nd argument: check if it's a format name or not. /// We can distinguish them by looking at the 2-nd argument: check if it's a format name or not.
if (args.size() == 4) if (args.size() == 4)
{ {
auto last_arg = args[1]->as<ASTLiteral &>().value.safeGet<String>(); auto second_arg = args[1]->as<ASTLiteral &>().value.safeGet<String>();
if (FormatFactory::instance().getAllFormats().contains(last_arg)) if (FormatFactory::instance().getAllFormats().contains(second_arg))
args_to_idx = {{"access_key_id", 1}, {"secret_access_key", 2}, {"format", 3}};
else
args_to_idx = {{"format", 1}, {"structure", 2}, {"compression_method", 3}}; args_to_idx = {{"format", 1}, {"structure", 2}, {"compression_method", 3}};
else
args_to_idx = {{"access_key_id", 1}, {"secret_access_key", 2}, {"format", 3}};
} }
/// For 3 arguments we support 2 possible variants: /// For 3 arguments we support 2 possible variants:
/// s3(source, format, structure) and s3(source, access_key_id, access_key_id) /// s3(source, format, structure) and s3(source, access_key_id, access_key_id)
/// We can distinguish them by looking at the 2-nd argument: check if it's a format name or not. /// We can distinguish them by looking at the 2-nd argument: check if it's a format name or not.
else if (args.size() == 3) else if (args.size() == 3)
{ {
auto third_arg = args[1]->as<ASTLiteral &>().value.safeGet<String>(); auto second_arg = args[1]->as<ASTLiteral &>().value.safeGet<String>();
if (FormatFactory::instance().getAllFormats().contains(third_arg)) if (FormatFactory::instance().getAllFormats().contains(second_arg))
args_to_idx = {{"format", 1}, {"structure", 2}}; args_to_idx = {{"format", 1}, {"structure", 2}};
else else
args_to_idx = {{"access_key_id", 1}, {"secret_access_key", 2}}; args_to_idx = {{"access_key_id", 1}, {"secret_access_key", 2}};