diff --git a/src/Functions/FunctionsCodingULID.cpp b/src/Functions/FunctionsCodingULID.cpp index 992f9cbf2d7..90e72abb7c1 100644 --- a/src/Functions/FunctionsCodingULID.cpp +++ b/src/Functions/FunctionsCodingULID.cpp @@ -158,8 +158,9 @@ public: Int64 ms = 0; memcpy(reinterpret_cast(&ms) + 2, buffer, 6); - if constexpr (std::endian::native == std::endian::little) - std::reverse(reinterpret_cast(&ms), reinterpret_cast(&ms) + sizeof(Int64)); +# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ + ms = std::byteswap(ms); +# endif return DecimalUtils::decimalFromComponents(ms / intExp10(DATETIME_SCALE), ms % intExp10(DATETIME_SCALE), DATETIME_SCALE); } diff --git a/src/Storages/StorageS3.cpp b/src/Storages/StorageS3.cpp index b4ca8f18b40..dd0742e8a47 100644 --- a/src/Storages/StorageS3.cpp +++ b/src/Storages/StorageS3.cpp @@ -771,7 +771,7 @@ public: configuration_.request_settings, std::nullopt, DBMS_DEFAULT_BUFFER_SIZE, - threadPoolCallbackRunner(IOThreadPool::get(), "S3ParallelRead"), + threadPoolCallbackRunner(IOThreadPool::get(), "S3ParallelWrite"), context->getWriteSettings()), compression_method, 3); diff --git a/src/TableFunctions/TableFunctionExecutable.cpp b/src/TableFunctions/TableFunctionExecutable.cpp index ae0946f8a50..66e7ce7592c 100644 --- a/src/TableFunctions/TableFunctionExecutable.cpp +++ b/src/TableFunctions/TableFunctionExecutable.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -25,7 +26,8 @@ namespace ErrorCodes { extern const int LOGICAL_ERROR; extern const int NUMBER_OF_ARGUMENTS_DOESNT_MATCH; - extern const int UNSUPPORTED_METHOD; + extern const int BAD_ARGUMENTS; + extern const int ILLEGAL_TYPE_OF_ARGUMENT; } std::vector TableFunctionExecutable::skipAnalysisForArguments(const QueryTreeNodePtr & query_node_table_function, ContextPtr) const @@ -61,6 +63,21 @@ void TableFunctionExecutable::parseArguments(const ASTPtr & ast_function, Contex "Table function '{}' requires minimum 3 arguments: script_name, format, structure, [input_query...]", getName()); + auto check_argument = [&](size_t i, const std::string & argument_name) + { + if (!args[i]->as() && + !args[i]->as() && + !args[i]->as() && + !args[i]->as()) + throw Exception(ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT, + "Illegal type of argument '{}' for table function '{}': must be an identifier or string literal", + argument_name, getName()); + }; + + check_argument(0, "script_name"); + check_argument(1, "format"); + check_argument(2, "structure"); + for (size_t i = 0; i <= 2; ++i) args[i] = evaluateConstantExpressionOrIdentifierAsLiteral(args[i], context); @@ -83,15 +100,18 @@ void TableFunctionExecutable::parseArguments(const ASTPtr & ast_function, Contex } else { - ASTPtr query = args[i]->children.at(0); - if (query->as()) + ASTPtr query; + if (!args[i]->children.empty()) + query = args[i]->children.at(0); + + if (query && query->as()) { input_queries.emplace_back(std::move(query)); } else { throw Exception( - ErrorCodes::UNSUPPORTED_METHOD, + ErrorCodes::BAD_ARGUMENTS, "Table function '{}' argument is invalid {}", getName(), args[i]->formatForErrorMessage()); diff --git a/tests/ci/run_check.py b/tests/ci/run_check.py index 4f38007cb03..4078b764492 100644 --- a/tests/ci/run_check.py +++ b/tests/ci/run_check.py @@ -180,6 +180,8 @@ def check_pr_description(pr_info: PRInfo) -> Tuple[str, str]: entry = " ".join(entry_lines) # Don't accept changelog entries like '...'. entry = re.sub(r"[#>*_.\- ]", "", entry) + # Don't accept changelog entries like 'Close #12345'. + entry = re.sub(r"^[\w\-\s]{0,10}#?\d{5,6}\.?$", "", entry) else: i += 1 diff --git a/tests/queries/0_stateless/02377_executable_function_settings.reference b/tests/queries/0_stateless/02377_executable_function_settings.reference index 5eef5774e14..edef1cca7a1 100644 --- a/tests/queries/0_stateless/02377_executable_function_settings.reference +++ b/tests/queries/0_stateless/02377_executable_function_settings.reference @@ -6,3 +6,4 @@ FROM executable(\'\', \'JSON\', \'data String\', SETTINGS max_command_execution_ -------------------- SELECT data FROM executable(\'\', \'JSON\', \'data String\', SETTINGS max_command_execution_time = 100, command_read_timeout = 1) +-------------------- diff --git a/tests/queries/0_stateless/02377_executable_function_settings.sql b/tests/queries/0_stateless/02377_executable_function_settings.sql index be60ad2d89b..ae0dc49c2fc 100644 --- a/tests/queries/0_stateless/02377_executable_function_settings.sql +++ b/tests/queries/0_stateless/02377_executable_function_settings.sql @@ -3,3 +3,7 @@ SELECT '--------------------'; EXPLAIN SYNTAX SELECT * from executable('', 'JSON', 'data String', SETTINGS max_command_execution_time=100); SELECT '--------------------'; EXPLAIN SYNTAX SELECT * from executable('', 'JSON', 'data String', SETTINGS max_command_execution_time=100, command_read_timeout=1); +SELECT '--------------------'; + +SELECT * from executable('JSON', 'data String', SETTINGS max_command_execution_time=100); -- { serverError ILLEGAL_TYPE_OF_ARGUMENT } +SELECT * from executable('JSON', 'data String', 'TEST', 'TEST'); -- { serverError BAD_ARGUMENTS }