timothyw553 commented on code in PR #1165:
URL: https://github.com/apache/iceberg-cpp/pull/1165#discussion_r4745117154


##########
src/iceberg/arrow/arrow_io.cc:
##########
@@ -484,26 +486,26 @@ class ArrowOutputFile : public OutputFile {
 }  // namespace
 
 Result<std::string> ArrowFileSystemFileIO::ResolvePath(const std::string& 
file_location) {
-  const auto pos = file_location.find("://");
-  if (pos == std::string::npos) {
-    return file_location;
+  const std::string_view uri(file_location);
+  if (::arrow::internal::AsciiEqualsCaseInsensitive(uri.substr(0, 6), 
"file:/") &&

Review Comment:
   to my understanding, only the single-slash path normalizes the scheme to 
lowercase and fails immediately if `PathFromUri` errors, while `file:///...` 
still falls through to the fallback below. with `MockFileSystem`, wouldn't 
`file:/tmp/x` fail while `file:///tmp/x` returns `/tmp/x`? should both slash 
forms share the same scheme normalization and error handling, with mixed-case 
tests for both?



##########
src/iceberg/arrow/arrow_io.cc:
##########
@@ -484,26 +486,26 @@ class ArrowOutputFile : public OutputFile {
 }  // namespace
 
 Result<std::string> ArrowFileSystemFileIO::ResolvePath(const std::string& 
file_location) {
-  const auto pos = file_location.find("://");
-  if (pos == std::string::npos) {
-    return file_location;
+  const std::string_view uri(file_location);
+  if (::arrow::internal::AsciiEqualsCaseInsensitive(uri.substr(0, 6), 
"file:/") &&

Review Comment:
   could we use `StringUtils::EqualsIgnoreCase` from 
`"iceberg/util/string_util.h"` instead of pulling in `arrow::internal` 
(swapping out `<arrow/util/string.h>`)? keeping the `substr(0, 6)` boundary 
also avoids `StartsWithIgnoreCase` unicode folding changing byte lengths.
   ```diff
   -  if (::arrow::internal::AsciiEqualsCaseInsensitive(uri.substr(0, 6), 
"file:/") &&
   +  if (StringUtils::EqualsIgnoreCase(uri.substr(0, 6), "file:/") &&
   ```



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