Skip to content

Validate row-index selections#8574

Open
gatesn wants to merge 3 commits into
developfrom
ngates/selection-index-sortedness
Open

Validate row-index selections#8574
gatesn wants to merge 3 commits into
developfrom
ngates/selection-index-sortedness

Conversation

@gatesn

@gatesn gatesn commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Rational for this change

We binary search the row selections and therefore panic if they are out of order. Therefore we should validate them on-construction to be sorted

What changes are included in this PR?

Include/ExcludeByIndex has try_new constructors.

An alternative would be to have a SortedBuffer wrapper type perhaps?

What APIs are changed? Are there any user-facing changes?

Include/ExcludeByIndex

gatesn added 2 commits June 24, 2026 10:54
Signed-off-by: "Nicholas Gates" <nick@nickgates.com>
Signed-off-by: "Nicholas Gates" <nick@nickgates.com>
@gatesn gatesn requested a review from a team June 24, 2026 15:05
@gatesn gatesn marked this pull request as draft June 24, 2026 15:06
Signed-off-by: "Nicholas Gates" <nick@nickgates.com>
@codspeed-hq

codspeed-hq Bot commented Jun 24, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 11.9%

⚠️ 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.

⚡ 4 improved benchmarks
✅ 1585 untouched benchmarks
⏩ 4 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation encode_varbin[(1000, 4)] 157 µs 139.8 µs +12.34%
Simulation encode_varbin[(1000, 32)] 162.5 µs 144.8 µs +12.22%
Simulation encode_varbin[(1000, 8)] 157.3 µs 140.4 µs +12.05%
Simulation encode_varbin[(1000, 2)] 156.1 µs 140.7 µs +10.98%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ngates/selection-index-sortedness (a2e44d2) with develop (2a19323)

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.

@gatesn gatesn added the changelog/fix A bug fix label Jun 24, 2026
@gatesn gatesn marked this pull request as ready for review June 24, 2026 15:17
@gatesn gatesn enabled auto-merge (squash) June 24, 2026 15:28
Comment thread vortex-jni/src/scan.rs
Comment on lines +100 to +105
1 => Selection::IncludeByIndex(StrictSortedBuffer::try_new(Buffer::copy_from(
selection_idx,
))?),
2 => Selection::ExcludeByIndex(StrictSortedBuffer::try_new(Buffer::copy_from(
selection_idx,
))?),

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.

can you remove the validation from java? JNI actually gets validated selections

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 have no idea where you want to assert that? Seems odd to accept it unchecked over FFI?

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.

If you look at the code you will notice that with this change this validation happens twice. I am asking you to have it happen once again as before this change. The validation happens on the java side of the jni bindings

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants