Skip to content

Fix hybrid scan reader state not fully reset for multi-threaded reuse - #22852

Closed
Deegue wants to merge 1 commit into
NVIDIA:mainfrom
Deegue:fix/hybrid-scan-reset-state
Closed

Fix hybrid scan reader state not fully reset for multi-threaded reuse#22852
Deegue wants to merge 1 commit into
NVIDIA:mainfrom
Deegue:fix/hybrid-scan-reset-state

Conversation

@Deegue

@Deegue Deegue commented Jun 11, 2026

Copy link
Copy Markdown

Description

hybrid_scan_reader_impl::reset_internal_state() was not resetting _output_chunk_produced and the three column selection flags (_is_filter_columns_selected, _is_payload_columns_selected, _is_all_columns_selected). When a reader instance is reused across multiple threads, stale state from a previous read carries over:

  • _output_chunk_produced being true causes is_first_output_chunk() to incorrectly return false
  • Column selection flags being true triggers early-return guards in select_all_columns() / select_filter_columns() / select_payload_columns(), skipping column setup entirely

This patch adds the missing resets to reset_internal_state().

closes #22851

Checklist

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

@Deegue
Deegue requested a review from a team as a code owner June 11, 2026 15:07
@Deegue
Deegue requested review from mythrocks and shrshi June 11, 2026 15:07
@copy-pr-bot

copy-pr-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the libcudf Affects libcudf (C++/CUDA) code. label Jun 11, 2026
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

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: 76f3df1e-6882-44c6-8fe4-2e38a753803f

📥 Commits

Reviewing files that changed from the base of the PR and between b969a3a and 3a9b1e6.

📒 Files selected for processing (1)
  • cpp/src/io/parquet/experimental/hybrid_scan_impl.cpp
🚧 Files skipped from review as they are similar to previous changes (1)
  • cpp/src/io/parquet/experimental/hybrid_scan_impl.cpp

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved Parquet reading reliability by ensuring reader state is consistently reset between operations, preventing intermittent inconsistencies in data chunking and retrieval and reducing unexpected empty or partial result chunks.

Walkthrough

Adds explicit resets in hybrid_scan_reader_impl::reset_internal_state(): sets _output_chunk_produced = false and clears _is_filter_columns_selected, _is_payload_columns_selected, and _is_all_columns_selected to ensure a consistent baseline for subsequent reads.

Changes

Hybrid Scan Reader State Reset

Layer / File(s) Summary
Complete internal state reset
cpp/src/io/parquet/experimental/hybrid_scan_impl.cpp
reset_internal_state() now sets _output_chunk_produced to false and clears _is_filter_columns_selected, _is_payload_columns_selected, and _is_all_columns_selected immediately after resetting _expr_conv and _mr, ensuring the reader does not carry stale flags across reuses.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • rapidsai/cudf#22716: Both PRs modify hybrid_scan_reader_impl::reset_internal_state() and related _output_chunk_produced handling.

Suggested labels

bug, non-breaking

Suggested reviewers

  • mhaseeb123
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: fixing incomplete state reset in hybrid scan reader for multi-threaded reuse scenarios.
Description check ✅ Passed The description is directly related to the changeset, explaining the bug, the issue it causes, and how the patch addresses it.
Linked Issues check ✅ Passed The PR directly addresses the objectives in issue #22851 by adding the missing resets for _output_chunk_produced and the three column selection flags to reset_internal_state().
Out of Scope Changes check ✅ Passed All changes are scoped to the reset_internal_state() function as required by issue #22851, with no extraneous modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@Deegue
Deegue force-pushed the fix/hybrid-scan-reset-state branch from b969a3a to 3a9b1e6 Compare June 11, 2026 15:13
@rjzamora

Copy link
Copy Markdown
Contributor

Thank you for the contribution @Deegue

@mhaseeb123 - Do you have time to look at this?

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

Please use the reader->reset_column_selection() API instead. See #22851 (comment)

@Deegue Deegue closed this Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libcudf Affects libcudf (C++/CUDA) code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Hybrid scan reader reset_internal_state() does not reset column selection and output chunk state

3 participants