gavinchou commented on code in PR #46393: URL: https://github.com/apache/doris/pull/46393#discussion_r1901753780
########## cloud/src/recycler/hdfs_accessor.cpp: ########## @@ -342,6 +344,47 @@ std::string HdfsAccessor::to_uri(const std::string& relative_path) { return uri_ + '/' + relative_path; } +std::string HdfsAccessor::extract_tablet_path(const std::string& path) { + // Check if path is empty + if (path.empty()) { + LOG_WARNING("input path is empty").tag("path", path); + return ""; + } + + // Check if path ends with '_' + if (path.back() != '_') { + LOG_WARNING("path must end with '_'").tag("path", path); + return ""; + } + + // Check if path matches the expected pattern + std::regex pattern(R"(^data/(\d+)/.+_$)"); + if (!std::regex_match(path, pattern)) { + LOG_WARNING("path format must be 'data/number/xxx_'").tag("path", path); + return ""; + } + + // Find the last '/' + size_t last_slash = path.find_last_of('/'); Review Comment: free function -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org