← Back to Pull requests

Hash scan tasks without re-hashing the base scan's payload #25498

Open
pentschev opened this pull request with 10 lines diff across 1 files
View on GitHub
pentschev pentschev commented on Nov 24, 2026 10:14 UTC
Author

ScanTask.get_hashable() and ParquetScanTask.get_hashable() embed self.base_scan.get_hashable(), i.e. the base scan's full hashable payload, which contains every path of the query. StreamingScan.get_hashable() hashes all of its tasks, so when lowering computes stable ids (lower_ir_graph_with_node_map -> Node.get_stable_id -> _update_stable_hasher), the full path list is fed to MD5 once per scan task. The cost is quadratic in the number of input files (tasks x paths).

The proposed change puts the base scan node into the task's hashable instead. _update_stable_hasher uses a Node's cached digest, so the base scan is hashed once. Hashing and equality still cover the base scan, only the stable id values change (identically on all ranks).

With about 70k S3 parquet files on 32 ranks (two scans of the same files, about 4,300 tasks per rank), every rank spent ~150 s in _update_stable_hasher before starting any work. With this change that phase disappears in a large query on 4x8 B200 and the end-to-end time drops from 491 s to ~285 s (identical, verified results). For a smaller range (~23k files) the idle phase was ~20 s, consistent with the quadratic growth.

Diff: 10 lines (+8 / -2) across 1 files Reviewer: wence- Review duration: 17483m
All Vouch review confidence checks passed
Residual risk 0.04 = Change Risk (0.41) × (1 − Review Confidence (0.91)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.41 · 10 lines diff across 1 files
0.41
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.94 · 2 substantive comment(s)
0.94
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
90%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.143
Sensitive Paths sensitive_paths
0.041
Real PR Conversation Timeline
3 items
coderabbitai[bot] coderabbitai[bot] commented on Nov 24, 2026 10:17 UTC
Bot

<!-- coderabbit-ai-generated:v1 -->

<!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- review_stack_entry_start -->

<a href="https://app.coderabbit.ai/change-stack/NVIDIA/cudf/pull/25498?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg" alt="Explain Change →" height="32"></picture></a>

<!-- review_stack_entry_end -->
<!-- recent_review_status_start -->

No actionable comments were generated in the recent review.

<!-- recent_review_status_end -->
<!-- walkthrough_start -->

<details>
<summary><strong>Summary</strong></summary>
<dl>
<dd>
<br>

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

Summary by CodeRabbit

Refactor
Updated how scan operations are distinguished, while preserving their existing path, split, schema, and Parquet details. This is an internal change and does not alter user-facing functionality or interfaces.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
ScanTask.get_hashable and ParquetScanTask.get_hashable now include the base_scan object directly in their tuples. The existing path, split, schema, and Parquet-specific values remain included.

Changes: Scan task hashing

|Layer / File(s)|Summary|
|:---|:---|
|Update scan task hashable tuples <br> python/cudf_polars/cudf_polars/streaming/io.py|Both get_hashable methods now include self.base_scan directly instead of self.base_scan.get_hashable(). Other tuple values remain unchanged.|

<!-- change_assessment_start -->
Estimated code review effort: 2 (Simple) | ~10 minutes

<!-- change_assessment_commit:"8d2c8df77af8aee04f616a689fd427d47250b27f" -->
<!-- change_assessment_priority:{"version":1,"urgency":"p2","manual":false} -->
Change: Refactor
<!-- change_assessment_end -->

Suggested labels: Python, Performance

Suggested reviewers: rjzamora, matt711

</dd>
</dl>
</details>

<!-- walkthrough_end -->
<details>
<summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>8d2c8</code></summary>
<dl>
<dd>
<br>

<!-- final_review_risk_start -->
<!-- final_review_risk_label
Merge Risk: ⚪ Minimal · up to 8d2c8
-->
<!-- final_review_risk_coverage:{"sourceCommitId":"8d2c8df77af8aee04f616a689fd427d47250b27f","coveredCommitId":"8d2c8df77af8aee04f616a689fd427d47250b27f","kind":"reviewed"} -->

This change reduces repeated hashing of the base scan's full path list when scan tasks are lowered. No concrete defect was found, and it looks safe to merge.
<!-- final_review_risk_end -->

</dd>
</dl>
</details>

<details>
<summary><strong>Security architecture risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>8d2c8</code></summary>
<dl>
<dd>
<br>

<!-- architecture_review_start -->
<!-- architecture_review_label

Security Architecture Review

Security architecture risk: ⚪ Minimal · up to 8d2c8
-->

Equivalent queries can receive different diagnostic identifiers before and after this update. The change does not alter which files a query reads or what permissions it uses.

Retained concerns
No architecture-level concerns identified.

<details>
<summary><strong>Security review details</strong></summary>
<dl>
<dd>
<br>

Trust Boundaries and Controls

  • _observed_ — The two changed methods build hashable representations of existing scan tasks. The diff does not change task construction, path selection, validation, or read authority.
  • </dd>
    </dl>
    </details>
    <!-- architecture_review_end -->

    </dd>
    </dl>
    </details>
    <!-- pre_merge_checks_walkthrough_start -->

    <details>
    <summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4</strong></summary>
    <dl>
    <dd>
    <br>

    | Check name | Status | Explanation |
    | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | Title check | !Passed | The title states the main change: scan task hashes no longer re-hash the base scan's full payload. The raw summary and objectives confirm that ScanTask and ParquetScanTask now embed the base scan node… |
    | Description check | !Passed | The description explains the problem (the base scan's full hashable payload, including every query path, is hashed once per scan task, which is quadratic in file count). It also describes the fix (emb… |
    | 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. |

    <details>
    <summary><strong>Full details: Title check</strong></summary>
    <dl>
    <dd>
    <br>

    Explanation

    The title states the main change: scan task hashes no longer re-hash the base scan's full payload. The raw summary and objectives confirm that ScanTask and ParquetScanTask now embed the base scan node rather than its full hashable representation. The title is specific and matches the changeset.

    </dd>
    </dl>
    </details>

    <details>
    <summary><strong>Full details: Description check</strong></summary>
    <dl>
    <dd>
    <br>

    Explanation

    The description explains the problem (the base scan's full hashable payload, including every query path, is hashed once per scan task, which is quadratic in file count). It also describes the fix (embedding the base scan Node so its cached digest is used) and gives performance measurements. This matches the changes in the raw summary.

    </dd>
    </dl>
    </details>

    </dd>
    </dl>
    </details>

    <!-- pre_merge_checks_walkthrough_end -->
    <!-- finishing_touch_checkbox_start -->

    <details>
    <summary><strong>Finishing Touches</strong></summary>
    <dl>
    <dd>
    <br>

    <details open>
    <summary><strong>Generate unit tests (beta)</strong></summary>
    <dl>
    <dd>
    <br>

  • <!-- {"checkboxId": "f47ac10b-58cc-4372-a567-0e02b2c3d479", "radioGroupId": "utg-output-choice-group-unknown_comment_id"} --> Create a new PR
  • </dd>
    </dl>
    </details>

    </dd>
    </dl>
    </details>

    <!-- finishing_touch_checkbox_end -->

    <!-- autopilot:start -->

  • <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autofix</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

  • <!-- autopilot:end -->
    <!-- recent_review_start -->

    <h6>
    <details>
    <summary><strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Recent review info</strong></summary>
    <dl>
    <dd>
    <br>

    <!-- review_info_content -->
    <details>
    <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</strong></summary>
    <dl>
    <dd>
    <br>

  • Source mode: Auto

  • Repository: [NVIDIA/cudf](<https://github.com/NVIDIA/cudf>)

  • Branch: [main](<https://github.com/NVIDIA/cudf/tree/main>)

  • File: [.coderabbit.yaml](<https://github.com/NVIDIA/cudf/blob/cd9b31cc1746ab8bca9fc697c934292b92351fd1/.coderabbit.yaml>)

  • Commit: [cd9b31c](<https://github.com/NVIDIA/cudf/commit/cd9b31cc1746ab8bca9fc697c934292b92351fd1>)

  • Layers: Repository YAML

  • Review profile: CHILL

  • Plan: Enterprise

  • Run ID: 2dd73eea-6e23-4e8e-bb5f-0fda8dbde2c8
  • </dd>
    </dl>
    </details>

    <details>
    <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</strong></summary>
    <dl>
    <dd>
    <br>

    Reviewing files that changed from the base of the PR and between cd9b31cc1746ab8bca9fc697c934292b92351fd1 and 8d2c8df77af8aee04f616a689fd427d47250b27f.

    </dd>
    </dl>
    </details>

    <details>
    <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 1</strong></summary>
    <dl>
    <dd>
    <br>

  • python/cudf_polars/cudf_polars/streaming/io.py
  • </dd>
    </dl>
    </details>

    Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

    </dd>
    </dl>
    </details>
    </h6>

    <!-- recent_review_end -->

    wence- wence- commented on code on Nov 24, 2026 11:41 UTC
    Code Review
    python/cudf_polars/cudf_polars/streaming/io.py:1
    @@ -498,7 +498,10 @@ def get_hashable(self) -> Hashable:
             return (
                 type(self),
                 tuple(self.schema.items()),
    -            self.base_scan.get_hashable(),
    +            # The base scan node itself, not its hashable: Node digests are cached,
    +            # so the base scan's payload (every path of the query) is hashed once
    +            # instead of once per scan task.
    +            self.base_scan,

    I agree with the spirit of this change, but not the implementation, I think... I need to remind myself how this fits together

    Reviewers
    Assignees
    pentschev pentschev
    Labels
    risk: low confidence: 90.9% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.5% (MEDIUM) · Higher = larger blast radius
    40.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 90.9% · Lower = rushed or shallow review
    90.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 3.7% · Safe to merge
    3.7%
    Repository