Repository navigation
fix(external): honor parquet batch byte budget - #27901
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
aunjgr
left a comment
There was a problem hiding this comment.
Reviewed exact head edd5a1a against base 89740fa. I read the complete four-file change. The page-mode path advances every physical column only after the accepted prefix is known, rolls all vectors back to checkpoints before remapping a smaller prefix, and guarantees at least one-row progress at the byte boundary. Row mode bounds lookahead and seeks back to the accepted offset, so unread rows are not lost. Batch count and byte admission remain bounded, error cleanup retains the existing page/row-reader owners, and the new tests cover fixed, variable, dictionary, nested, rollback, oversized-row, and repeated-call cases. Exact-head CI is fully green. I found no merge-blocking issue.
|
Queued — the merge queue status continues in this comment ↓. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Reviewed exact head edd5a1abc326f0e786f198be651d75680cc7b144 against its declared base 89740fae15dbba2cbe104348659694283cb160a6.
The byte-boundary implementation itself has coherent forward-progress and ownership rules: page mode advances all physical columns only after choosing the accepted prefix; rollback/remap preserves page offsets; dictionary-backed varlena accounting handles shared area ranges; and row mode bounds lookahead then seeks back to the accepted offset. I did not find a separate correctness, deadlock, or cleanup blocker in that exact diff.
However, this head can no longer be approved or merged as reviewed. PR #27902 (baa78c2a76cc6907836ceefea99710e930bc21e6) has since landed on main and changes the same prepare() path to prune nested Parquet projections and to make page iterators versus the projected row reader mutually exclusive. GitHub currently reports this PR as CONFLICTING, with a content conflict in pkg/sql/colexec/external/parquet.go. Exact-head CI therefore proves only the pre-#27902 implementation; it does not prove that byte budgeting and nested projection pruning coexist.
Please rebase onto latest main and resolve this semantically, preserving both invariants:
- Nested mode must construct the projected row group/row reader from only projected columns and must not open unused page iterators.
- Page mode must still initialize and advance every projected physical leaf together, while retaining the variable-width budget-column tracking introduced here.
After resolving, run the Parquet batch-budget tests together with the nested projection tests on the rebased head. This is a required integration change, not a cosmetic conflict resolution.
There was a problem hiding this comment.
[P1] Stale generated-column state causes deterministic batch-size collapse
External.Call reuses the same batch and calls:
ReadBatch -> CleanOnlyData -> ReadBatch
A Hive default partition column can be represented by a const-NULL vector whose data buffer is nil. CleanOnlyData clears the data buffer but can leave the previous logical length in that vector.
estimatedBatchSize starts from bat.Size(), so the stale generated-column length is counted as existing data. generatedBatchBytes then counts the same generated column again for the next candidate rows.
I reproduced this on exact head adf52a1 with one INT32 physical column, one Hive default TEXT partition column, 100 rows, and a 1 KiB budget:
- First batch: 34 rows
- Stale const-NULL logical length after cleanup: 34
- Second batch: 5 rows
This does not lose rows, but when the byte budget is active it can repeatedly shrink batches and increase downstream scan/dispatch overhead for identical input.
Please fix the admission calculation so it is independent of generated-vector state left by the previous batch, and add a regression test that reuses one batch with CleanOnlyData and a Hive default const-NULL partition column. Keep the fix scoped; a global Vector cleanup semantic change needs broader compatibility evidence.
Other review dimensions passed:
- Page progress and rollback: no lost or duplicated rows found
- Resource lifecycle: no new leak or double-close found
- Cancellation/waiting: no new hang path found
- Bounds: lookahead and batch admission remain bounded
- Count-only path: O(1)/O(log n) behavior preserved
- Exact-head substantive CI: green
The current tests allocate a fresh batch for each ReadBatch, so they do not cover this production reuse path.
adf52a1 to
7010608
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep re-reviewed exact head 701060891904ca23e18320a6fab5b85b1ef852e7 against base c46d897e9645b80178568ef0783dd8e99e527222, including issue #27895, the complete four-file diff, every earlier review finding, the latest stale-vector delta, page and nested modes, generated columns, row-count-only performance, resource ownership, and exact-head CI.
The latest commit closes the remaining deterministic batch-reuse regression without changing global vector cleanup semantics. physicalBatchSize now counts only vectors backed by projected Parquet columns, while generatedBatchBytes reserves virtual, partition, Iceberg metadata, and schema-evolution output separately. The same source-only baseline is used both for admission and precise prefix rollback. Therefore a const-NULL Hive partition vector whose logical length survives CleanOnlyData is neither treated as new physical input nor double-counted on the next call. The added production-shape regression reuses one batch and confirms stable row counts and correct source progress.
I also rechecked the broader implementation:
- page mode advances every projected physical leaf only after a common accepted prefix, and rollback/remap does not publish source progress early;
- nested mode bounds decoder lookahead, rolls back the first rejected row, and seeks to the accepted source offset on the next call;
- virtual-only, mixed physical and generated, Iceberg DML, and missing-column NULL output are admitted before publication;
- one oversize row still guarantees forward progress, while later rows wait for the next batch;
- row-count-only with no generated output remains constant time, and generated-only admission is logarithmic;
- page and row-reader error paths retain their existing owners and cleanup. No new goroutine, wait edge, leak, double close, unbounded retained collection, or log loop is introduced.
Exact-head substantive CI is terminal green and git diff --check passes. I found no remaining correctness, performance, Q1/Q2/Q3 unhappy-path, or merge blocker. APPROVE.
Merge Queue Status
This pull request spent 31 seconds in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. Tick the box to put this pull request back in the merge queue (same as
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #27895
What this PR does / why we need it:
fix(external): honor parquet batch byte budget