Skip to content

Extend MaskValuesRef to filter execution - #9542

Open
connortsui20 wants to merge 4 commits into
developfrom
ct/mask-value-ref
Open

Extend MaskValuesRef to filter execution#9542
connortsui20 wants to merge 4 commits into
developfrom
ct/mask-value-ref

Conversation

@connortsui20

@connortsui20 connortsui20 commented Aug 21, 2026

Copy link
Copy Markdown
Member

Summary

Extends MaskValuesRef through filter execution and the remaining private helpers that receive a shared mask handle.

Also cleans up some code around the changes.

Changes

Replaces &Arc<MaskValues> and private &MaskValues parameters with &MaskValuesRef. Matches selection masks once in the Filter vtable and DuckDB validity exporter, preserving empty-mask precedence and existing behavior.

@codspeed-hq

codspeed-hq Bot commented Aug 21, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 12.82%

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

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 564 untouched benchmarks
⏩ 1470 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation cold_misaligned[(16, 64)] 429.3 µs 380.5 µs +12.82%

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 ct/mask-value-ref (8eef241) with develop (68cdf00)

Open in CodSpeed

Footnotes

  1. 1470 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.

connortsui20 and others added 2 commits August 21, 2026 15:00
Filter execution passes shared mask handles through private helpers and clones
them to rebuild masks for child arrays. Spell those boundaries as
MaskValuesRef instead of Arc<MaskValues> or MaskValues.

This keeps ownership visible at each call site and avoids dereferencing
through the handle.

Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S6E8CET6sGJwL2VhFAoLig
Filter execution matched the mask twice: `execute_filter_fast_paths` resolved
the all-true and all-false cases through `true_count`, then the vtable
re-matched for the `MaskValuesRef` behind an `unreachable!`. Match the mask
once in the vtable and pass the true count to the remaining all-null fast
path.

The DuckDB validity exporter had the same shape, where a `bool` predicate
matched the mask and the closure that built `ValidityData` matched it again
behind an `unreachable!`. Return the data from one match instead.

Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S6E8CET6sGJwL2VhFAoLig
@connortsui20 connortsui20 added the changelog/chore A trivial change label Aug 21, 2026
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Comment on lines -155 to -157
if let Some(canonical) = execute_filter_fast_paths(array.as_view(), ctx)? {
return Ok(ExecutionResult::done(canonical));
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

moving logic around to keep related code closer

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

Labels

changelog/chore A trivial change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant