Skip to content

exec: decode build rows of either layout in the reversed grace join - #253

Merged
techgopal merged 1 commit into
mainfrom
fix/row-layout-grace-mark
Oct 26, 2026
Merged

techgopal merged 1 commit into
mainfrom
fix/row-layout-grace-mark

Conversation

@techgopal

Copy link
Copy Markdown
Contributor

With krishiv.exec.join.rowLayout=true, TPC-H SF10 q21 at a 2 GiB memory limit panicked (index out of bounds decoding a zero-length row) on the grace join's reversed semi/anti path.

Cause: a reversed semi or anti join with a residual condition decoded its build rows in mark_pairs through the arrow-row payload accessor, which returns an empty slice for chunks stored in the row layout.

Fix: candidate pairs keep the build row index, and mark_pairs decodes through Shared::build_columns — the path the probe side already uses — so either payload format works.

Test: a_reversal_with_a_condition_decodes_the_build_rows_of_either_layout runs a reversed semi join with a condition in both layouts; it fails with the q21 panic on the old code and passes now. All krishiv-exec tests pass.

A reversed semi or anti join with a residual condition decoded its build rows in mark_pairs through the arrow-row payload accessor, which returns an empty slice for chunks stored in the row layout, so TPC-H q21 with krishiv.exec.join.rowLayout=true panicked while spilling (index out of bounds on a zero-length row). Candidate pairs now keep the build row index and mark_pairs decodes through Shared::build_columns, the same path the probe uses, so either payload format works. A new test runs a reversed semi join with a condition in both layouts.

Signed-off-by: gopal tathe <44522021+techgopal@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between e41bf4f and dd3cccd.

Files selected for processing: 1
  • crates/krishiv-exec/src/join/grace.rs

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

Walkthrough

The reversed grace join path now retains build row indices for residual-condition evaluation. It retrieves build columns through Shared::build_columns for both payload-row and Arrow-row layouts. A test checks reversed semi joins under both layouts.

Changes: Reversed Grace Join Evaluation

Layer / File(s) Summary
Indexed residual evaluation and layout coverage
crates/krishiv-exec/src/join/grace.rs
Candidate pairs now retain probe and build row indices. Residual evaluation uses the current RowArena and Shared::build_columns. The test checks that both row layouts emit the expected odd-key probe rows.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Merge Risk: Minimal · up to dd3cc

The row-layout fix has no established outstanding merge-blocking issue; it is ready for normal checks.

Architecture risk: Medium · up to dd3cc

The change affects 1 system.

Changed systems: crates

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — crates (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in crates/krishiv-exec/src/join/grace.rs: Candidate pairs now store probe and build row indices for the current arena chunk instead of probe indices and borrowed payload bytes.
  • observed — Modified behavior in crates/krishiv-exec/src/join/grace.rs: When a residual filter exists, matching candidates are queued by row index; batches reaching PAIR_BATCH and the final remainder are evaluated using the probe batch and current arena. Without a filter, matching probe rows are still marked directly.
  • observed — Modified behavior in crates/krishiv-exec/src/join/grace.rs: mark_pairs now accepts hashing state, the current build RowArena, and indexed candidate pairs; its documentation specifies that build columns are decoded according to the arena’s payload or Arrow-row format.
  • observed — Modified behavior in crates/krishiv-exec/src/join/grace.rs: Build columns for residual evaluation are now obtained from Shared::build_columns using the configured row-layout mode and the indexed rows in the current arena, replacing decoding stored payload byte slices.

Reliability and maintainability

  • inferred — Risk-relevant change factors for crates: blast_radius_2; blast_radius_3; direct_dependents_1; direct_dependents_2
Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description clearly explains the failure, root cause, fix, and regression test. However, it omits the required Task/spec/ADR references, test commands with result lines, and the completed checklis… Add the Task/spec/ADR references, paste the exact test commands and result lines, and complete each applicable checklist item. Keep the existing failure, cause, fix, and test details.
Docstring Coverage Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: decoding build rows of either layout in the reversed grace join.
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.
Full details: Description check

Explanation

The description clearly explains the failure, root cause, fix, and regression test. However, it omits the required Task/spec/ADR references, test commands with result lines, and the completed checklist.

Resolution

Add the Task/spec/ADR references, paste the exact test commands and result lines, and complete each applicable checklist item. Keep the existing failure, cause, fix, and test details.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.25926% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/krishiv-exec/src/join/grace.rs 99.2% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@codspeed

codspeed Bot commented Oct 26, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 9 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 142 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing fix/row-layout-grace-mark (dd3cccd) with main (e41bf4f)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@techgopal
techgopal added this pull request to the merge queue Oct 26, 2026
Merged via the queue into main with commit 5246e3d Oct 26, 2026
47 checks passed
@techgopal
techgopal deleted the fix/row-layout-grace-mark branch October 26, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant