fix(filesystem): list files through every registered scheme - #274
fix(filesystem): list files through every registered scheme#274hampsterx wants to merge 1 commit into
Conversation
Reading from `r2://`, `oss://`, `hdfs://`, `smb://`, `ftp://`, `dbfs://`, `oci://` or `webhdfs://` raised `KeyError: '<scheme>'` on the first matched file, so those sources could construct but never load anything. File discovery resolved each file's modification date through dlt's table of per-scheme extractors, where an entry reads one backend-specific key out of the listing (`LastModified` for `s3`, `updated` for `gs`, `last_modified` for `az`). A scheme absent from that table has no entry to read, and only the schemes dlt itself ships are present. Resolve the date from the listing instead: consult dlt's extractor first, so every scheme it knows keeps its exact behaviour, then read the key the backend emits and decode it the way that backend encodes it. Each pairing is taken from the backend's own `modified()`, which reads the same key: WebHDFS counts in milliseconds, FTP reports an RFC 3659 `modify` fact, Databricks names it `modified`. Prefer a specific key over `mtime`, because SMB carries both that and `time`, and `time` is the access time. This also covers a client whose listing uses a different key than its scheme is mapped to, which is what any `pyarrow.fs` client does. A listing with no usable date names the scheme, the keys present and why each candidate was rejected, rather than raising `KeyError` on one of them. FTP servers without MLSD land there: fsspec parses their `dir` output into a year-less `Aug 4 09:30`, which cannot name an instant. Cover the resolver per scheme with each backend's own value encoding, and read an S3-compatible bucket through `r2://` end to end against the emulator.
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #274 +/- ##
==========================================
+ Coverage 60.23% 60.38% +0.15%
==========================================
Files 236 237 +1
Lines 11157 11223 +66
==========================================
+ Hits 6720 6777 +57
- Misses 4437 4446 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
r2://,oss://,hdfs://,smb://,ftp://,dbfs://,oci://andwebhdfs://. Listing raisedKeyError: '<scheme>'on the first matched file, so those sources could construct but never load anything.KeyErroron one of them.Changes
dlt_filesystem/source/lister.py, holdingglob_files(vendored fromdlt.common.storages.fsspec_filesystem) plusresolve_modification_date. dlt's own per-scheme extractor is consulted first, so every scheme it knows keeps its exact behaviour.modified(): WebHDFS counts milliseconds, FTP reports an RFC 3659modifyfact,fsspec-databricksnames the keymodified, ossfs and s3fs useLastModified, ocifs usestimeModified.mtimelast, since SMB carries both it andtime, wheretimeis the access time.Aug 4 09:30that fsspec parses out ofdiroutput on FTP servers without MLSD, because it cannot name an instant.hf://scheme is registered.This also covers a client whose listing uses a different key than its scheme is mapped to, which is what any
pyarrow.fsclient does (ArrowFSWrapperreportsmtimewhatever the backend). That is the discovery-side blocker for GH-233.Test plan
tests/main/filesystem/test_remote_integration.py, including a new S3-compatible read throughr2://glob_filesfails the new r2 test withKeyError: 'r2'References
pyarrow.fsmigration)