geruh commented on code in PR #3161:
URL: https://github.com/apache/iceberg-python/pull/3161#discussion_r3083416296
##########
pyiceberg/io/pyarrow.py:
##########
@@ -397,7 +397,8 @@ def parse_location(location: str, properties: Properties =
EMPTY_DICT) -> tuple[
"""
uri = urlparse(location)
- if not uri.scheme:
+ if not uri.scheme or (len(uri.scheme) == 1 and uri.scheme.isalpha()):
+ # len == 1 and alpha catches Windows drive letters like C:\ D:\
default_scheme = properties.get("DEFAULT_SCHEME", "file")
default_netloc = properties.get("DEFAULT_NETLOC", "")
return default_scheme, default_netloc, os.path.abspath(location)
Review Comment:
Looks like a few other places use the urlparse and will be affected like fs
spec and schema resolution.
https://github.com/apache/iceberg-python/blob/3a993e82b158919b3c1c110df6d21eb044a6616c/pyiceberg/io/__init__.py#L337-L346
Maybe we could create a helper in the init class that all modules could use.
##########
pyiceberg/io/pyarrow.py:
##########
Review Comment:
We could still add against `parse_location` here for the drive something
that can ensure we are treating drive letters as local paths and not uri
schemes.
How about something like this with the windows paths as parameters
```
def test_parse_location_windows_drive_letter() -> None:
loc = "C:\\Users\\test\\file.avro"
scheme, netloc, _ = PyArrowFileIO.parse_location(loc)
assert scheme == "file"
assert netloc == ""
```
--
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]