qzyu999 opened a new issue, #3720:
URL: https://github.com/apache/iceberg-python/issues/3720

   ### Apache Iceberg version
   Latest main (also affects all released versions)
   
   ### Please describe the bug
   
   On Windows, passing a local absolute path (e.g. `C:\Users\data\warehouse`) 
to any PyIceberg IO operation crashes with:
   
   ``nValueError: Unrecognized filesystem type in URI: c
   ``n
   The root cause: Python's `urlparse` treats Windows drive letters as URI 
schemes (`C:\...`  `scheme='c'`). Since `'c'` is not in PyIceberg's 
scheme-to-FileIO mapping, all local file operations fail.
   
   This affects three independent parse sites:
   1. `_infer_file_io_from_scheme()` in `pyiceberg/io/__init__.py`  
   2. `PyArrowFileIO.parse_location()` in `pyiceberg/io/pyarrow.py`  
   3. `FsspecFileIO._get_fs_from_uri()` in `pyiceberg/io/fsspec.py`  
   
   ### Related issues
   
   - #2477 (CI: run tests on Windows  lists this as the primary failure)
   - #1005 (user report  closed as stale without fix)
   - PR #3161 (partial fix  only pyarrow, no tests, went stale)
   - PR #996 (partial fix  only pyarrow, went stale)
   
   ### Proposed fix
   
   A platform-guarded predicate that detects when `urlparse` has misidentified 
a Windows drive letter as a URI scheme, and remaps it to `'file'`:
   
   `python
   import sys
   
   def _is_windows_drive_letter(scheme: str) -> bool:
       return sys.platform == 'win32' and len(scheme) == 1 and scheme.isalpha()
   ``n
   Applied at all three parse sites. Zero behavior change on non-Windows (the 
platform check short-circuits). Includes platform-conditional tests.


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