Skip to content

Commit ffc2fb8

Browse files
address review: parse URI via arrow::util::Uri instead of matching error text
1 parent 46e09fd commit ffc2fb8

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/iceberg/arrow/arrow_io.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -484,14 +484,13 @@ Result<std::string> ArrowFileSystemFileIO::ResolvePath(const std::string& file_l
484484
return std::move(path).ValueOrDie();
485485
}
486486

487-
// Only fall back for Arrow's scheme-mismatch error; propagate anything else.
488-
const auto& status = path.status();
489-
if (status.message().find("expected a URI with one of the schemes") ==
490-
std::string::npos) {
487+
// Foreign alias (s3a/s3n): validate via Arrow's parser, then percent-decode the
488+
// scheme-less key (substring keeps a Windows drive letter's ':' that host() drops).
489+
if (auto parsed = ::arrow::util::Uri::FromString(file_location); !parsed.ok()) {
490+
const auto& status = parsed.status();
491491
return std::unexpected<Error>{
492492
{.kind = ToErrorKind(status), .message = status.ToString()}};
493493
}
494-
// Scheme-less bucket/key: drop ?query / #fragment and percent-decode to match s3://.
495494
std::string bucket_key = file_location.substr(pos + 3);
496495
bucket_key = bucket_key.substr(0, bucket_key.find_first_of("?#"));
497496
return ::arrow::util::UriUnescape(bucket_key);

0 commit comments

Comments
 (0)