Skip to content

Poc index layout - #9706

Merged
joseph-isaacs merged 14 commits into
vortex-data:developfrom
polarsignals:poc-index-layout
Oct 21, 2026
Merged

joseph-isaacs merged 14 commits into
vortex-data:developfrom
polarsignals:poc-index-layout

Conversation

@thorfour

Copy link
Copy Markdown
Contributor

Summary

This is a PoC of the Indexed Layout described in the above issue.

Changes

This implements the IndexVTable trait that Index implementations can implement to be utilized in an IndexLayout.

Adds an example ReverseIndex that implements the trait and it's use is demonstrated in a couple unit tests. Additionally adds a datafusion test that validates that fewer bytes are read from a Vortex file when an indexed layout is successfully utilized.

@codspeed

codspeed Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ 20 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

ℹ️ 40 benchmarks have no flame graph

The flamegraph could not be generated because we failed to resolve the symbols in the profiling trace. This happens when we fail to harvest information about language frames.

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 2406 untouched benchmarks
⏩ 12 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ WallTime bitpack_blocked_compress_avx2 6.8 µs 7.6 µs -11.12%
⚡ WallTime mul_u64_nonnull_neon 39.5 µs 20.9 µs +88.51%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing polarsignals:poc-index-layout (b0660fd) with develop (e717fab)2

Open in CodSpeed

Footnotes

  1. 12 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. ↩

  2. No successful run was found on develop (f990a5d) during the generation of this report, so e717fab was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

Comment thread vortex-layout/src/layouts/indexed/reader.rs
Comment thread vortex-layout/src/layouts/indexed/index.rs Outdated
Comment thread vortex-layout/src/layouts/indexed/index.rs Outdated
Comment thread vortex-layout/src/layouts/indexed/mod.rs
Comment on lines +136 to +159
RowLocator::Rows(rows) => {
let start = u32::try_from(row_range.start)?;
let end = u32::try_from(row_range.end)?;
let mut pos = row_range.start;
for row in rows.range(start..end) {
let row = u64::from(row);
bits.append_n(false, usize::try_from(row - pos)?);
bits.append_n(true, 1);
pos = row + 1;
}
bits.append_n(false, usize::try_from(row_range.end - pos)?);
}
// Broadcast each block's bit across the rows it covers, clipped to `row_range`.
RowLocator::Blocks { block_len, ids } => {
let mut row = row_range.start;
while row < row_range.end {
let block = row / block_len;
let block_end = ((block + 1) * block_len).min(row_range.end);
let hit = ids.contains(u32::try_from(block)?);
bits.append_n(hit, usize::try_from(block_end - row)?);
row = block_end;
}
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks quite low. append_n is pretty expensive. Can be optimised later

Comment thread vortex-layout/src/layouts/indexed/index.rs
@joseph-isaacs

Copy link
Copy Markdown
Contributor

Looking promising

Comment thread vortex-layout/examples/reverse_index/main.rs
Comment thread vortex-layout/src/layouts/indexed/index.rs Outdated
Comment thread vortex-layout/src/layouts/indexed/writer.rs
Comment thread vortex-layout/Cargo.toml Outdated
Comment thread vortex-layout/examples/reverse_index/datafusion_tests.rs Outdated
this.register(&LegacyStats as &dyn LayoutEncoding);
this.register(&Dict as &dyn LayoutEncoding);
this.register(&List as &dyn LayoutEncoding);
this.register(&Indexed as &dyn LayoutEncoding);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robert3005 We added layouts to editions correct so this will be filtered?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not the expert but looking at the code that appears to be correct.

Comment thread vortex-layout/src/layouts/indexed/index.rs Outdated
Comment thread vortex-layout/src/layouts/indexed/index.rs Outdated
Comment thread vortex-layout/src/layouts/indexed/index.rs Outdated
Comment thread vortex-layout/src/layouts/indexed/index.rs Outdated
@thorfour
thorfour marked this pull request as ready for review October 2, 2026 17:06
@thorfour
thorfour requested a review from joseph-isaacs October 2, 2026 18:16
@github-actions

Copy link
Copy Markdown
Contributor

This PR has been marked as stale because it has been open for 14 days with no activity. Please comment or remove the stale label if you wish to keep it active, otherwise it will be closed in 7 days

@github-actions github-actions Bot added the stale This PR is stale and will be auto-closed soon label Oct 17, 2026
@thorfour

Copy link
Copy Markdown
Contributor Author

Commenting to remove from stale list. Back from vacation and picking this back up.

@thorfour thorfour added changelog/feature A new feature and removed stale This PR is stale and will be auto-closed soon labels Oct 19, 2026
Adds an indexed layout to the Vortex layout crate based on vortex-data#9024

Signed-off-by: Thor <thor.hansen@dash0.com>
Intended as an example implementation of a indexed-layout index.

Signed-off-by: Thor <thor.hansen@dash0.com>
Signed-off-by: Thor <thor.hansen@dash0.com>
Signed-off-by: Thor <thor.hansen@dash0.com>
vortex-reverse-index was a standalone worked example of the vortex.indexed
IndexVTable contract; move it to vortex-layout/examples/reverse_index,
following the plain cargo-example convention used by vortex-ffi/examples
instead of shipping it as its own workspace crate.

vortex-datafusion could no longer dev-depend on it as a library once it
became a cargo example, so its DataFusion integration test moves along
with it (examples/reverse_index/datafusion_tests.rs), rebuilt against
vortex-datafusion's public API and a manually assembled session instead
of the vortex facade crate, which vortex-layout cannot depend on.

Signed-off-by: "Thor" <thor.hansen@dash0.com>
Signed-off-by: Thor <thor.hansen@dash0.com>
IndexedReader::plan_probe returned on the first spec that claimed an
expression, regardless of exactness. A Superset claim from an earlier
spec could shadow a later, more precise Exact claim, and multiple
Superset claims on the same expression never got combined.

CachedProbe is now Exact(locator) or Superset(Vec<locator>): plan_probe
scans every spec, preferring any Exact claim outright and otherwise
collecting all Superset claims. pruning_evaluation intersects every
Superset locator (short-circuiting once nothing survives), and
filter_evaluation only fast-paths on an Exact claim.

Signed-off-by: "Thor" <thor.hansen@dash0.com>
Signed-off-by: Thor <thor.hansen@dash0.com>
Signed-off-by: Thor <thor.hansen@dash0.com>
This allows only a portion of an index to be read for a portion of the
rows.

Signed-off-by: Thor <thor.hansen@dash0.com>
Signed-off-by: Thor <thor.hansen@dash0.com>
Signed-off-by: Thor <thor.hansen@dash0.com>
at build time
Updated IndexQueryPlan to use a BoundExpression now.

Signed-off-by: Thor <thor.hansen@dash0.com>
options are parsed once per reader, and each chunk is decoded once and
shared.

Signed-off-by: Thor <thor.hansen@dash0.com>
Added some tests with golden files for serializing/deserializing index
layouts.

Signed-off-by: Thor <thor.hansen@dash0.com>
Signed-off-by: Thor <thor.hansen@dash0.com>
@joseph-isaacs

Copy link
Copy Markdown
Contributor

Thanks for the contribution!

@joseph-isaacs
joseph-isaacs merged commit 8374e7a into vortex-data:develop Oct 21, 2026
96 of 97 checks passed
@thorfour
thorfour deleted the poc-index-layout branch October 21, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants