Skip to content

perf(reader): fold an i32 global dict column off its codes, not a per-row copy - #603

Merged
dfa1 merged 1 commit into
mainfrom
perf/global-dict-fold
Oct 24, 2026
Merged

dfa1 merged 1 commit into
mainfrom
perf/global-dict-fold

Conversation

@dfa1

@dfa1 dfa1 commented Oct 24, 2026

Copy link
Copy Markdown
Owner

A dict chunk spanning several scan windows was expanded to one 4-byte value per row before each window folded it. The shared flat now keeps an i32 dict as a dict; windows slice only the codes, and DictIntArray gathers straight off the pool (u8 and u16 codes).

  • Offset views (OffsetByte/Short/Int/LongArray) report their window via segmentIfPresent() when the inner buffer covers it, so a sliced dict's codes are flat.
  • ParquetVsVortexReadBenchmark.vortexReadMultiColumn: 162 → 182 ops/s single fork (quiet); 133.8 → 155.4 (+16%) at 3 forks, base and change in one noisier session.
  • RealFileScanBenchmark A/B on all seven real files: within noise (store_sales, appian-order re-checked at 3 forks).

Full ./mvnw verify passes locally.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SwhK4W5cgj7y7s4ZPCif5x

…-row copy

A dict chunk that spans several scan windows (a global dict column's
codes chunk at 512Ki rows against 128Ki-row windows) was canonicalized
once per covering flat: DictIntArray.materialize wrote a 4-byte value for
every row, and each window then folded that copy. The shared flat now
keeps an i32 dict as a dict over canonical codes and pool; each window
slices only the codes, and DictIntArray.fold/materialize gather straight
off the pool.

For that to reach the fast path, the byte/short/int/long offset views
report their window as their segment when the inner buffer covers it,
and DictIntArray's gathers handle u8 codes as well as u16 (without u8,
TPC-DS store_sales lost 4%).

ParquetVsVortexReadBenchmark.vortexReadMultiColumn (PULocationID is a
global dict): 162 -> 182 ops/s single fork on a quiet machine;
3 forks base vs change in one later, noisier session 133.8 -> 155.4
(+16%). RealFileScanBenchmark A/B on all seven real files: within noise
(store_sales and appian-order re-checked at 3 forks, alternating).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SwhK4W5cgj7y7s4ZPCif5x
@dfa1
dfa1 force-pushed the perf/global-dict-fold branch from 37ce2b0 to 6521a71 Compare October 24, 2026 17:34
@dfa1
dfa1 merged commit 29d4147 into main Oct 24, 2026
6 checks passed
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