qzyu999 opened a new pull request, #3721:
URL: https://github.com/apache/iceberg-python/pull/3721

   ## Rationale
   
   On Windows, `urlparse('C:\Users\...')` produces `scheme='c'`, causing:
   
   ``nValueError: Unrecognized filesystem type in URI: c
   ``n
   This breaks all local file operations for Windows users.
   
   ## The Fix
   
   A single platform-guarded predicate shared across all three affected parse 
sites:
   
   `python
   def _is_windows_drive_letter(scheme: str) -> bool:
       return sys.platform == 'win32' and len(scheme) == 1 and scheme.isalpha()
   ``n
   When detected, the scheme is remapped to `'file'`, which routes to 
PyArrow/fsspec's local filesystem  which already handles Windows paths natively.
   
   ## Changes
   
   | File | Change |
   |------|--------|
   | `pyiceberg/io/__init__.py` | Add predicate + normalize scheme in 
`_infer_file_io_from_scheme` |
   | `pyiceberg/io/pyarrow.py` | Guard in `parse_location` |
   | `pyiceberg/io/fsspec.py` | Guard in `_get_fs_from_uri` |
   | `tests/io/test_io.py` | Predicate + integration tests |
   | `tests/io/test_pyarrow.py` | `parse_location` Windows test |
   
   ## Why all three sites?
   
   They execute at different lifecycle stages and are reachable through 
independent code paths. Fixing only one (as PR #3161 did) leaves the others 
broken.
   
   ## Regression safety
   
   The `sys.platform == 'win32'` guard means this is **literally invisible** on 
Linux/macOS  the predicate short-circuits to `False` without inspecting the 
scheme. Existing CI on `ubuntu-latest` cannot observe any change.
   
   ## Are these changes tested?
   
   Yes. 11 new test cases covering:
   - Predicate correctness (real schemes  False, drive letters on Windows  True)
   - Integration (Windows paths resolve to PyArrowFileIO)
   - Platform-conditional via `@pytest.mark.skipif`  
   
   All existing tests continue to pass.
   
   ## Closes
   
   Closes #3720
   Related: #2477, #1005


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