Skip to content

Add python bindings for hybrid scan metadata and release GIL in the reader APIs - #23546

Merged
rapids-bot[bot] merged 12 commits into
NVIDIA:mainfrom
Matt711:fea/pylibcudf/hybrid-scan-metadata-and-gil
Aug 21, 2026
Merged

Add python bindings for hybrid scan metadata and release GIL in the reader APIs#23546
rapids-bot[bot] merged 12 commits into
NVIDIA:mainfrom
Matt711:fea/pylibcudf/hybrid-scan-metadata-and-gil

Conversation

@Matt711

@Matt711 Matt711 commented Aug 5, 2026

Copy link
Copy Markdown
Member

Description

This PR allows multiple HybridScanReader instances to share pre-parsed Parquet file metadata rather than each re-parsing it. It also releases the GIL in all existing HybridScanReader methods. Used in #23317.

Checklist

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

@Matt711 Matt711 added feature request New feature or request non-breaking Non-breaking change labels Aug 5, 2026
@copy-pr-bot

copy-pr-bot Bot commented Aug 5, 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 libcudf Affects libcudf (C++/CUDA) code. Python Affects Python cuDF API. pylibcudf Issues specific to the pylibcudf package labels Aug 5, 2026
@GPUtester GPUtester moved this to In Progress in cuDF Python Aug 5, 2026
@Matt711

Matt711 commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

/ok to test 44c9b4f

@Matt711
Matt711 marked this pull request as ready for review August 5, 2026 22:32
@Matt711
Matt711 requested review from a team as code owners August 5, 2026 22:32
@Matt711
Matt711 requested review from bdice and wence- August 5, 2026 22:32
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 70a46b15-4e2b-4ab4-a3bd-728850af3da4

📥 Commits

Reviewing files that changed from the base of the PR and between a98ad61 and aeb06b9.

📒 Files selected for processing (13)
  • cpp/include/cudf/io/experimental/hybrid_scan.hpp
  • cpp/src/io/parquet/experimental/hybrid_scan.cpp
  • cpp/src/io/parquet/experimental/hybrid_scan_impl.cpp
  • cpp/src/io/parquet/experimental/hybrid_scan_impl.hpp
  • cpp/src/io/parquet/reader_impl.cpp
  • cpp/src/io/parquet/reader_impl.hpp
  • cpp/tests/io/experimental/hybrid_scan_common.cpp
  • cpp/tests/io/experimental/hybrid_scan_test.cpp
  • python/pylibcudf/pylibcudf/io/experimental/__init__.py
  • python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pxd
  • python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyi
  • python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyx
  • python/pylibcudf/pylibcudf/libcudf/io/hybrid_scan.pxd
🚧 Files skipped from review as they are similar to previous changes (13)
  • python/pylibcudf/pylibcudf/io/experimental/init.py
  • cpp/src/io/parquet/experimental/hybrid_scan_impl.hpp
  • cpp/tests/io/experimental/hybrid_scan_common.cpp
  • cpp/src/io/parquet/reader_impl.cpp
  • cpp/src/io/parquet/experimental/hybrid_scan.cpp
  • cpp/src/io/parquet/reader_impl.hpp
  • python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyi
  • cpp/src/io/parquet/experimental/hybrid_scan_impl.cpp
  • python/pylibcudf/pylibcudf/libcudf/io/hybrid_scan.pxd
  • cpp/include/cudf/io/experimental/hybrid_scan.hpp
  • python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pxd
  • cpp/tests/io/experimental/hybrid_scan_test.cpp
  • python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyx

Included review availability: Your plan includes up to 12 reviews per rolling hour; 8 remain after this review.


📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added reusable Parquet metadata for sharing across multiple hybrid scan readers.
    • Exposed HybridScanMetadata and metadata-based reader creation in Python.
    • Added metadata construction from footer bytes or parsed Parquet metadata.
    • Added a utility to build row masks for selected row groups.
  • Improvements

    • Hybrid scan APIs now accept general sequences of chunk and span data.
    • Reduced Python thread blocking during native operations.
    • Improved handling of empty and multi-step chunk data during materialization.

Walkthrough

The change adds shared Parquet metadata for hybrid scan readers. It exposes metadata construction and reader reuse through libcudf and pylibcudf, adds all-true row-mask creation, releases the GIL during native operations, and adds shared-reader validation.

Changes

Hybrid Scan Metadata

Layer / File(s) Summary
C++ metadata ownership and reader integration
cpp/include/cudf/io/experimental/hybrid_scan.hpp, cpp/src/io/parquet/experimental/..., cpp/src/io/parquet/reader_impl.*
Adds hybrid_scan_metadata, shared ownership for aggregate metadata, and reader construction from existing metadata.
Python metadata bindings and public APIs
python/pylibcudf/pylibcudf/io/experimental/*, python/pylibcudf/pylibcudf/libcudf/io/hybrid_scan.pxd
Exposes metadata factories, HybridScanReader.from_metadata, all-true row-mask creation, and Sequence[Span] input types.
Native execution and chunk-data handling
python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyx
Releases the GIL around native operations, moves returned values, handles empty buffers, and retains chunk data during chunked reads.
Shared metadata reader validation
cpp/tests/io/experimental/hybrid_scan_{common.cpp,test.cpp}
Adds test data support and verifies readers that share metadata against standard Parquet reader results.

Estimated code review effort: 4 (Complex) | ~60 minutes

Merge Risk: ⚪ Minimal · up to aeb06

The PR adds shared hybrid-scan metadata bindings and releases the GIL in reader APIs; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: mythrocks, wence-

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the two primary changes: Python bindings for hybrid scan metadata and GIL release in reader APIs.
Description check ✅ Passed The description directly explains shared Parquet metadata, GIL release, related issues, and test coverage intent.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyi (1)

65-150: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Make the runtime accept the declared Sequence[Span] inputs.

The stub declares seven Sequence[Span] parameters, but the matching Cython methods declare them as list. Tuple inputs are rejected before _get_device_span() runs. Change the runtime parameters to accept sequence-compatible objects, or restore list[Span] in the stub.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyi` around lines 65 -
150, Align the runtime signatures of the hybrid scan methods accepting span
collections with the stub’s Sequence[Span] declarations, rather than list-only
annotations. Update the corresponding dictionary-page, bloom-filter,
materialization, and chunking methods so tuple and other sequence inputs reach
_get_device_span() without rejection; keep the existing behavior for list
inputs.
🧹 Nitpick comments (1)
cpp/tests/io/experimental/hybrid_scan_test.cpp (1)

1002-1031: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Test the FileMetaData constructor.

Line 1003 tests only the footer-byte constructor. hybrid_scan_metadata(FileMetaData const&, ...) is a separate new public path. Add a case that constructs shared metadata from materialized FileMetaData and validates both reader results.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cpp/tests/io/experimental/hybrid_scan_test.cpp` around lines 1002 - 1031,
Extend the test around hybrid_scan_metadata construction to materialize
FileMetaData and add a shared-metadata case using
hybrid_scan_metadata(FileMetaData const&, ...), rather than only the
footer-buffer constructor. Reuse the existing reader flow and expected table,
and validate both independent reader results produced from the
FileMetaData-based metadata.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyx`:
- Around line 831-844: Protect each HybridScanReader instance with its own lock,
and acquire it across setup_chunking_for_filter_columns plus
has_next_table_chunk() and materialize_*_chunk() stateful operations, including
related wrapper-state updates. Ensure the lock spans the nogil native calls and
accesses to _input_columns, _output_buffers, _row_mask_offset,
_output_chunk_produced, and selection flags, while keeping locks independent
between reader instances.
- Around line 121-126: Update both from_parquet_metadata() methods and the
HybridScanMetadata() constructor to validate wrapper arguments and their c_obj
fields before entering with nogil or invoking native code. Raise TypeError for
None or invalid wrapper types and ValueError for wrappers with empty c_obj,
preventing null native dereferences while preserving valid construction.
- Line 867: Update the chunk materialization flow around _filter_chunk_data so
both _filter_chunk_data and _payload_chunk_data remain available across all
chunks returned by the native reader. Only clear these buffers after the final
chunk has been materialized, not after the first chunk.

---

Outside diff comments:
In `@python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyi`:
- Around line 65-150: Align the runtime signatures of the hybrid scan methods
accepting span collections with the stub’s Sequence[Span] declarations, rather
than list-only annotations. Update the corresponding dictionary-page,
bloom-filter, materialization, and chunking methods so tuple and other sequence
inputs reach _get_device_span() without rejection; keep the existing behavior
for list inputs.

---

Nitpick comments:
In `@cpp/tests/io/experimental/hybrid_scan_test.cpp`:
- Around line 1002-1031: Extend the test around hybrid_scan_metadata
construction to materialize FileMetaData and add a shared-metadata case using
hybrid_scan_metadata(FileMetaData const&, ...), rather than only the
footer-buffer constructor. Reuse the existing reader flow and expected table,
and validate both independent reader results produced from the
FileMetaData-based metadata.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ef7ee563-811e-4451-9f38-e82b3af7b83d

📥 Commits

Reviewing files that changed from the base of the PR and between 1b2e313 and a870eff.

📒 Files selected for processing (13)
  • cpp/include/cudf/io/experimental/hybrid_scan.hpp
  • cpp/src/io/parquet/experimental/hybrid_scan.cpp
  • cpp/src/io/parquet/experimental/hybrid_scan_impl.cpp
  • cpp/src/io/parquet/experimental/hybrid_scan_impl.hpp
  • cpp/src/io/parquet/reader_impl.cpp
  • cpp/src/io/parquet/reader_impl.hpp
  • cpp/tests/io/experimental/hybrid_scan_common.cpp
  • cpp/tests/io/experimental/hybrid_scan_test.cpp
  • python/pylibcudf/pylibcudf/io/experimental/__init__.py
  • python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pxd
  • python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyi
  • python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyx
  • python/pylibcudf/pylibcudf/libcudf/io/hybrid_scan.pxd

Comment thread python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyx Outdated
Comment thread python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyx
Comment thread python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyx Outdated
@Matt711
Matt711 force-pushed the fea/pylibcudf/hybrid-scan-metadata-and-gil branch from a870eff to 06df8af Compare August 5, 2026 23:12

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
cpp/tests/io/experimental/hybrid_scan_test.cpp (1)

1007-1020: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Keep both readers alive during the shared-metadata test.

Each read_all_columns() call destroys its reader before the next call. The tests validate sequential reuse only.

Create both readers first. Interleave their operations before destroying either reader. This detects reader-specific state that is incorrectly stored in shared metadata.

Based on PR objectives, this change must validate multiple HybridScanReader instances sharing metadata.

Also applies to: 1057-1069

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cpp/tests/io/experimental/hybrid_scan_test.cpp` around lines 1007 - 1020,
Update the shared-metadata test around read_all_columns so both HybridScanReader
instances are created before either is destroyed, then interleave their
row-group discovery, byte-range fetching, and materialization operations.
Preserve the existing table comparisons while ensuring both readers remain alive
throughout the test; apply the same lifetime pattern to the corresponding block
near the second referenced section.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@cpp/tests/io/experimental/hybrid_scan_test.cpp`:
- Around line 1007-1020: Update the shared-metadata test around read_all_columns
so both HybridScanReader instances are created before either is destroyed, then
interleave their row-group discovery, byte-range fetching, and materialization
operations. Preserve the existing table comparisons while ensuring both readers
remain alive throughout the test; apply the same lifetime pattern to the
corresponding block near the second referenced section.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 593ce8d1-b6de-439b-9708-1ccc214d0774

📥 Commits

Reviewing files that changed from the base of the PR and between 1b2e313 and 9fafd51.

📒 Files selected for processing (13)
  • cpp/include/cudf/io/experimental/hybrid_scan.hpp
  • cpp/src/io/parquet/experimental/hybrid_scan.cpp
  • cpp/src/io/parquet/experimental/hybrid_scan_impl.cpp
  • cpp/src/io/parquet/experimental/hybrid_scan_impl.hpp
  • cpp/src/io/parquet/reader_impl.cpp
  • cpp/src/io/parquet/reader_impl.hpp
  • cpp/tests/io/experimental/hybrid_scan_common.cpp
  • cpp/tests/io/experimental/hybrid_scan_test.cpp
  • python/pylibcudf/pylibcudf/io/experimental/__init__.py
  • python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pxd
  • python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyi
  • python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyx
  • python/pylibcudf/pylibcudf/libcudf/io/hybrid_scan.pxd
🚧 Files skipped from review as they are similar to previous changes (11)
  • cpp/src/io/parquet/reader_impl.cpp
  • cpp/src/io/parquet/experimental/hybrid_scan_impl.hpp
  • cpp/src/io/parquet/experimental/hybrid_scan_impl.cpp
  • python/pylibcudf/pylibcudf/io/experimental/init.py
  • cpp/tests/io/experimental/hybrid_scan_common.cpp
  • cpp/include/cudf/io/experimental/hybrid_scan.hpp
  • cpp/src/io/parquet/experimental/hybrid_scan.cpp
  • python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pxd
  • python/pylibcudf/pylibcudf/libcudf/io/hybrid_scan.pxd
  • cpp/src/io/parquet/reader_impl.hpp
  • python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyi

@NVIDIA NVIDIA deleted a comment from coderabbitai Bot Aug 5, 2026
@NVIDIA NVIDIA deleted a comment from coderabbitai Bot Aug 5, 2026
@Matt711

Matt711 commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

/ok to test 9fafd51

Comment thread python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyx Outdated
Comment thread python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyx Outdated
if len(footer_bytes) > 0:
footer_ptr = &footer_bytes[0]
with nogil:
self.c_obj = make_unique[cpp_hybrid_scan_metadata](

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be a shared pointer?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. I think the answer is no, it doesn't "need" to be a shared pointer. We can come up with a scenario where we end up creating multiple python HybridScanMetadata objects from the same file. With the idea being they could all share ownership of the same C++ hybrid_scan_metadata. I think I would argue in favor of the sticking with the simpler ownership sematintics of unique_ptr and then just implementing a way of caching at the python level to handle the shared metadata scenario.

@wence- wence- left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am concerned about lifetime of references in the python bindings

Comment thread cpp/include/cudf/io/experimental/hybrid_scan.hpp Outdated
Comment thread cpp/include/cudf/io/experimental/hybrid_scan.hpp Outdated
Comment thread python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyx
Comment thread python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyx
Comment thread python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyx
Comment thread python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyx
@Matt711
Matt711 requested review from a team as code owners August 12, 2026 20:07
@Matt711
Matt711 requested review from mythrocks and wence- August 12, 2026 20:07

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyx`:
- Around line 95-104: Update the typed metadata parameters in
from_parquet_metadata and from_metadata to require not None, and validate
metadata.c_obj before entering any nogil block so unset metadata raises a
TypeError rather than dereferencing null. Add an __init__ to HybridScanMetadata
that rejects direct construction, preventing default-initialized instances with
an empty unique_ptr.

In `@python/pylibcudf/pylibcudf/libcudf/io/hybrid_scan.pxd`:
- Around line 104-108: Update build_all_true_row_mask in
python/pylibcudf/pylibcudf/libcudf/io/hybrid_scan.pxd at lines 104-108 to use
std_span[const_size_type] for row_group_indices, matching the native std::span
API. Update the build_all_true_row_mask call in
python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyx at lines 490-497 to
construct std_span from indices_vec.data() and indices_vec.size() instead of
host_span.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ffb876b4-fce4-4412-a11b-0f353fbe23cc

📥 Commits

Reviewing files that changed from the base of the PR and between 1b2e313 and 916cd4c.

📒 Files selected for processing (13)
  • cpp/include/cudf/io/experimental/hybrid_scan.hpp
  • cpp/src/io/parquet/experimental/hybrid_scan.cpp
  • cpp/src/io/parquet/experimental/hybrid_scan_impl.cpp
  • cpp/src/io/parquet/experimental/hybrid_scan_impl.hpp
  • cpp/src/io/parquet/reader_impl.cpp
  • cpp/src/io/parquet/reader_impl.hpp
  • cpp/tests/io/experimental/hybrid_scan_common.cpp
  • cpp/tests/io/experimental/hybrid_scan_test.cpp
  • python/pylibcudf/pylibcudf/io/experimental/__init__.py
  • python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pxd
  • python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyi
  • python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyx
  • python/pylibcudf/pylibcudf/libcudf/io/hybrid_scan.pxd

Comment thread python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyx
Comment thread python/pylibcudf/pylibcudf/libcudf/io/hybrid_scan.pxd

@wence- wence- left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving with one C++ docs nit

Comment thread cpp/include/cudf/io/experimental/hybrid_scan.hpp Outdated
@Matt711
Matt711 force-pushed the fea/pylibcudf/hybrid-scan-metadata-and-gil branch from 0bd51ef to aeb06b9 Compare August 18, 2026 15:59
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@mhaseeb123
mhaseeb123 self-requested a review August 18, 2026 16:01

@mhaseeb123 mhaseeb123 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking merge to review it.

@mhaseeb123 mhaseeb123 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving for now. I will look open a subsequent PR with a broader refactor to remove confusion between ownerships and copies.

Comment on lines +92 to +98
/**
* @brief Own Parquet file metadata from a pre-populated `FileMetaData`
*
* @param parquet_metadata Pre-populated Parquet file metadata
* @param options Parquet reader options
*/
hybrid_scan_metadata(FileMetaData const& parquet_metadata, parquet_reader_options const& options);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking as it needs a broader fix in a follow up. This may be misleading as the FileMetaData object is copied internally by metadata(FileMetaData&) and any subsequent operations (such as setting page index) on hybrid_scan_metadata won't affect the original FileMetaData it was constructed from.

Comment on lines +77 to +79
* @note The metadata is immutable after `setup_page_index()` has been called (or immediately after
* construction if page index setup is skipped). Concurrent usage by multiple readers is thread
* safe. This handle does not support multi-source (multi-file) metadata.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: setup_page_index() may itself only be called from one reader using this. Otherwise, it is not thread-safe.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This docstring feels off. The object itself is not immutable. Immutability is enforced at the level of the reader that takes in and leverages this metadata in a particular way. The shared_ptr management is all done in the readers, not here. The documentation and management of appropriate usage should be in the place where that control is actually happening.

@coderabbitai coderabbitai Bot mentioned this pull request Aug 19, 2026
3 tasks

@vyasr vyasr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit concerned about exactly how the ownership sharing is done here.

Comment on lines +77 to +79
* @note The metadata is immutable after `setup_page_index()` has been called (or immediately after
* construction if page index setup is skipped). Concurrent usage by multiple readers is thread
* safe. This handle does not support multi-source (multi-file) metadata.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This docstring feels off. The object itself is not immutable. Immutability is enforced at the level of the reader that takes in and leverages this metadata in a particular way. The shared_ptr management is all done in the readers, not here. The documentation and management of appropriate usage should be in the place where that control is actually happening.

Comment thread cpp/src/io/parquet/experimental/hybrid_scan.cpp
Comment thread cpp/src/io/parquet/experimental/hybrid_scan_impl.cpp

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on my other feedback, can you add a test that actually creates multiple readers? That would suss out the kinds of issues I was worried about above.

Comment thread python/pylibcudf/pylibcudf/io/experimental/hybrid_scan.pyx Outdated
Comment thread cpp/src/io/parquet/experimental/hybrid_scan.cpp
Comment thread cpp/src/io/parquet/experimental/hybrid_scan_impl.cpp
@vyasr

vyasr commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

My other two bits of feedback are still valid and I'd like to see them implemented, but the shared_ptr moves no longer look unsafe here so I'm approving to unblock. Thanks!

@Matt711

Matt711 commented Aug 21, 2026

Copy link
Copy Markdown
Member Author

/merge

@rapids-bot
rapids-bot Bot merged commit 26eca08 into NVIDIA:main Aug 21, 2026
285 of 287 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in cuDF Python Aug 21, 2026
@github-project-automation github-project-automation Bot moved this from In Progress to Done in cuDF Python Aug 21, 2026
@Matt711
Matt711 deleted the fea/pylibcudf/hybrid-scan-metadata-and-gil branch August 21, 2026 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request New feature or request libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change pylibcudf Issues specific to the pylibcudf package Python Affects Python cuDF API.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

8 participants