← Back to Pull requests

fix(delta): drain all batches per scan file in DeltaInputSourceIterator #19592

Closed
unknown closed this pull request without merging on Jun 18, 2026 21:20 UTC
View on GitHub
unknown unknown commented on Jun 17, 2026 10:42 UTC
Author

Fixes #18606.

Description

Bug

DeltaInputSourceIterator.hasNext() used a local variable for the per-file
CloseableIterator<FilteredColumnarBatch>. When the method returned true after
finding the first non-empty batch of a file, that iterator went out of scope.
The next hasNext() call advanced to the next file, skipping all remaining
batches of the current file.

With the Delta kernel's default batch size of 1024 rows, this produced exactly
1024 × numFiles rows regardless of actual file size — matching the symptom
reported in #18606.

Fix

Promoted filteredBatchIterator to a class field (currentFileIterator).
hasNext() now drains all batches of the current file before advancing to the
next one. Also fixed close() to close currentFileIterator and drain all
remaining file iterators (the original only closed one).

Regression test

Added LargeRowGroupDeltaTable (2 Parquet files × 2000 rows = 4000 total) and
BatchDrainRegressionTests inside DeltaInputSourceTest.

  • Without the fix: 1024 × 2 = 2048 rows returned

  • With the fix: 4000 rows returned
  • Release note

    Fixed a bug in the Delta Lake input source where only 1024 rows per Parquet file
    were ingested. Ingestion tasks now return all rows from each file.

    ---

    ##### Key changed/added classes in this PR

  • DeltaInputSourceReader (fix)

  • LargeRowGroupDeltaTable (new test descriptor)

  • DeltaInputSourceTest (new BatchDrainRegressionTests inner class)

  • src/test/resources/large-row-group-table (new test Delta table)
  • ---

    This PR has:

  • been self-reviewed.

  • a release note entry in the PR description.

  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.

  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • Diff: 248 lines (+186 / -62) across 3 files Reviewer: abhishekrb19 Review duration: 2078m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 248 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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.330
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #19592"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    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: 38.9% (MEDIUM) · Higher = larger blast radius
    38.9%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 15.4% · Safe to merge
    15.4%
    Repository