From 7d4eacc9716cbdb2958a803188dc2dc48a3b0ffe Mon Sep 17 00:00:00 2001 From: liutang123 Date: Tue, 28 Jul 2026 22:33:28 +0800 Subject: [PATCH] [Fix](udf) strip file name when http url has query string --- be/src/runtime/user_function_cache.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/be/src/runtime/user_function_cache.cpp b/be/src/runtime/user_function_cache.cpp index 7199cc7e1ff407..ab7b42fcadc450 100644 --- a/be/src/runtime/user_function_cache.cpp +++ b/be/src/runtime/user_function_cache.cpp @@ -463,6 +463,14 @@ std::string UserFunctionCache::_get_file_name_from_url(const std::string& url) c } else { file_name = url; } + // Strip the query string (e.g. the "?q-sign-algorithm=..." of a COS/S3 + // presigned URL). Otherwise it would be treated as part of the file name, + // which may exceed the filesystem NAME_MAX (255 bytes) limit and cause + // fopen to fail with ENAMETOOLONG. + size_t query_pos = file_name.find('?'); + if (query_pos != std::string::npos) { + file_name = file_name.substr(0, query_pos); + } return file_name; }