plusplusjiajia commented on code in PR #703:
URL: https://github.com/apache/iceberg-cpp/pull/703#discussion_r3374075048
##########
src/iceberg/arrow/arrow_io.cc:
##########
@@ -473,11 +473,26 @@ class ArrowOutputFile : public OutputFile {
} // namespace
Result<std::string> ArrowFileSystemFileIO::ResolvePath(const std::string&
file_location) {
- if (file_location.find("://") != std::string::npos) {
- ICEBERG_ARROW_ASSIGN_OR_RETURN(auto path,
arrow_fs_->PathFromUri(file_location));
- return path;
+ const auto pos = file_location.find("://");
+ if (pos == std::string::npos) {
+ return file_location;
}
- return file_location;
+
+ auto path = arrow_fs_->PathFromUri(file_location);
+ if (path.ok()) {
+ return std::move(path).ValueOrDie();
+ }
+
+ // Only fall back for Arrow's scheme-mismatch error; propagate anything else.
+ const auto& status = path.status();
+ if (status.message().find("expected a URI with one of the schemes") ==
+ std::string::npos) {
+ return std::unexpected<Error>{
+ {.kind = ToErrorKind(status), .message = status.ToString()}};
+ }
+ // Scheme-less bucket/key, dropping any ?query / #fragment.
+ std::string bucket_key = file_location.substr(pos + 3);
+ return bucket_key.substr(0, bucket_key.find_first_of("?#"));
Review Comment:
@MisterRaindrop Good catch — fixed. The fallback now percent-decodes the key
via arrow::util::UriUnescape, so s3a/s3n resolve identically to native s3://
(a%20b → a b).
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]