TheR1sing3un opened a new pull request, #7731:
URL: https://github.com/apache/paimon/pull/7731

   ## Purpose
   
   `PyArrowFileIO._initialize_hdfs_fs` calls `splitport(netloc)` followed by 
`int(port_str)`. ViewFS and HDFS HA URIs have no port, so `port_str` is `None` 
and we hit `TypeError: int() argument must be a string ... not 'NoneType'` 
before reaching `pafs.HadoopFileSystem`.
   
   This PR resolves `(host, port)` up-front so all three URI shapes work 
without surprising the user:
   
   - `viewfs://...` (with or without netloc) → `host='default', port=0` so 
libhdfs reads `fs.defaultFS` and resolves the ViewFS mount table from 
`core-site.xml`.
   - `hdfs://nameservice/...` (HA, no port) or `hdfs:///...` (no netloc) → also 
`host='default', port=0` to delegate to `fs.defaultFS`.
   - `hdfs://host:port/...` → connect directly with the parsed host/port.
   
   The `host`/`port` variables are reused by the existing Kerberos branch 
unchanged.
   
   ## Linked issue
   
   N/A — surfaced when running pypaimon against a ViewFS-backed cluster and an 
HDFS HA nameservice without an explicit port.
   
   ## Tests
   
   New `HdfsFileIOTest` in `pypaimon/tests/file_io_test.py` covering:
   
   - `test_viewfs_uses_default_host` — `viewfs://clusterName`
   - `test_viewfs_without_netloc_uses_default_host` — `viewfs:///path`
   - `test_hdfs_with_port_uses_explicit_host` — `hdfs://namenode:8020`
   - `test_hdfs_ha_nameservice_without_port_uses_default_host` — 
`hdfs://nameservice1`
   - `test_hdfs_without_netloc_uses_default_host` — `hdfs:///path`
   - `test_hdfs_missing_hadoop_home_raises` / 
`test_hdfs_missing_hadoop_conf_dir_raises` — guard checks
   
   Local: `pytest pypaimon/tests/file_io_test.py` → 22 passed; `flake8 
--config=dev/cfg.ini` clean.
   
   ## API and format
   
   No public API change. No file format change. Behaviour change is restricted 
to URI shapes that previously raised `TypeError` and are now usable.
   
   ## Documentation
   
   No documentation change required.
   
   ## Generative AI disclosure
   
   Drafted with assistance from an AI coding tool; all logic reviewed by the 
author and validated by the tests above.


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

Reply via email to