MisterRaindrop commented on code in PR #703:
URL: https://github.com/apache/iceberg-cpp/pull/703#discussion_r3377291615


##########
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:
   This approach is problematic. It relies on Arrow's English error messages, 
which will break if Arrow changes the message text. It does not simultaneously 
check status.code(), for example, to verify whether it is actually 
StatusCode::Invalid.



-- 
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]

Reply via email to