plusplusjiajia commented on code in PR #703:
URL: https://github.com/apache/iceberg-cpp/pull/703#discussion_r3377368554
##########
src/iceberg/arrow/arrow_io.cc:
##########
@@ -473,11 +474,27 @@ 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") ==
Review Comment:
@MisterRaindrop Good point — dropped the error-text match. ResolvePath now
validates the URI with arrow::util::Uri::Parse (a malformed URI fails there and
propagates) and then percent-decodes the scheme-less bucket/key, so it no
longer depends on Arrow's message text or status code.
--
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]