Skip to content

Support filesystem in cuIO paths - #23904

Draft
mhaseeb123 wants to merge 4 commits into
NVIDIA:mainfrom
mhaseeb123:claude/cudf-issue-20443-add5ad
Draft

Support filesystem in cuIO paths#23904
mhaseeb123 wants to merge 4 commits into
NVIDIA:mainfrom
mhaseeb123:claude/cudf-issue-20443-add5ad

Conversation

@mhaseeb123

@mhaseeb123 mhaseeb123 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Description

Under 🚧

Closes #20443
Closes #23899

This PR adds a new filesystem param to our orc, json, csv and parquet readers and writers to accept a pre-built fsspec filesystem object. Added validation by a shared _validate_filesystem helper that keeps the existing "not at the same time as storage_options" contract. For read_parquet_metadata, the remote metadata reads also get a parquet-footer prefetcher which does a speculative read of 64KiB, trim to the exact footer, and hands libcudf PAR1 + footer + ender.

Also two minor fixes: _process_dataset now passes its already-resolved filesystem to is_directory(), which previously inferred LocalFileSystem and answered False for every remote path; and ParquetDatasetWriter.write_table no longer drops self.storage_options for non-S3 remote paths.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Closes NVIDIA#20443

Only `read_parquet` accepted a pre-built fsspec `filesystem` object; every
other reader and all writers accepted `storage_options` only. Add a
`filesystem=` keyword to `read_csv`, `read_json`, `read_orc`, `read_avro`,
`read_text`, `to_parquet`, `to_csv`, `to_json`, `to_orc`, `write_to_dataset`
and `ParquetDatasetWriter`, plumbed through `ioutils` and validated by a
shared `_validate_filesystem` helper.

Co-Authored-By: Claude Opus 5 <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the Python Affects Python cuDF API. label Aug 31, 2026
@mhaseeb123 mhaseeb123 changed the title Support filesystem argument in more cuDF I/O paths Support filesystem in cuIO paths Aug 31, 2026
Closes NVIDIA#23899

`read_parquet_metadata` took only `filepath_or_buffer`, so footer metadata
could not be read from authenticated remote stores. Forward `storage_options`
and `filesystem` to `get_reader_filepath_or_buffer` like the other readers.

Co-Authored-By: Claude Opus 5 <[email protected]>
@mhaseeb123 mhaseeb123 added 2 - In Progress Currently a work in progress improvement Improvement / enhancement to an existing function non-breaking Non-breaking change cudf.pandas Issues specific to cudf.pandas and removed improvement Improvement / enhancement to an existing function cudf.pandas Issues specific to cudf.pandas labels Aug 31, 2026
Remote reads route through `_prefetch_remote_buffers(method="all")`, which
pulls whole files into host memory. That is pure waste for
`read_parquet_metadata`, which needs only the footer, and `method="parquet"`
does not help since it falls back to `_get_remote_bytes_all` when no columns
or row groups are selected.

Add a `parquet-footer` prefetcher that reads a 64 KiB tail, matching libcudf's
LIBCUDF_PARQUET_METADATA_SIZE_HINT, trims it to the exact footer, and hands
libcudf `PAR1` + footer + ender. libcudf locates the footer relative to the end
of a source, so this parses identically while the buffer stays O(footer)
instead of O(file): 2.8 KB rather than 7.5 MB on a 200k-row test file.

Co-Authored-By: Claude Opus 5 <[email protected]>
@mhaseeb123 mhaseeb123 added the feature request New feature or request label Aug 31, 2026
@mhaseeb123 mhaseeb123 moved this from Todo to In Progress in cuDF Python Aug 31, 2026
The footer prefetcher called `fs.sizes()` to compute tail offsets, which costs
an extra HEAD per file and adds a second sequential round trip before the
ranges can be requested.

Use suffix ranges instead: a negative `start` means "backwards from the end"
per the fsspec `cat_file` contract, and clamps to the whole file when the file
is shorter than the read. A short tail is therefore already the entire file,
so the truncated-footer and non-Parquet cases can be detected without a size
lookup. Measured on moto with 20 files: 20 requests instead of 40, all issued
concurrently by `cat_ranges` on async filesystems.

Co-Authored-By: Claude Opus 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2 - In Progress Currently a work in progress feature request New feature or request non-breaking Non-breaking change Python Affects Python cuDF API.

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Support storage_options in Parquet metadata reads (cudf.io.parquet.read_parquet_metadata) [FEA] Support filesystem in more I/O paths (to_parquet etc)

1 participant