Skip to content

Add filter-and-scatter RowFn execution - #9521

Draft
connortsui20 wants to merge 2 commits into
developfrom
ct/row-fn-filter-scatter
Draft

Add filter-and-scatter RowFn execution#9521
connortsui20 wants to merge 2 commits into
developfrom
ct/row-fn-filter-scatter

Conversation

@connortsui20

@connortsui20 connortsui20 commented Aug 20, 2026

Copy link
Copy Markdown
Member

Rationale for this change

Partially valid RowFn inputs cannot always use direct skip-invalid execution. That path skips the row function for null rows, but it still decodes the original columns first. Vortex does not guarantee that the stored payload behind a null is meaningful, so decoding those rows can fail before the row loop has a chance to skip them.

Geometry columns expose this limitation. A null row can contain coordinate or offset storage that does not describe a valid geometry. Some geometry representations can substitute safe placeholders, but not every native geometry type supports that.

The current spatial executor handles this by filtering each input to the combined valid rows before decoding it. It computes the compact result and then scatters those values back to their original positions. The existing implementation does that here.

[A, null, B] -> filter -> [A, B] -> execute -> [x, y] -> scatter -> [x, null, y]

#9349 moves spatial distance onto the shared RowFn executor. This PR adds the same fallback there so the conversion preserves the existing null-handling behavior instead of requiring every input type to decode arbitrary null payloads.

What changes are included in this PR?

For a partially valid batch, the executor first tries the cheaper direct valid-row path. If an input decoder or output sink cannot support that path, it filters every input to the valid rows, runs the ordinary dense kernel, validates the compact output, and scatters the values back to the original row positions.

The existing all-valid and all-null fast paths are unchanged.

@codspeed-hq

codspeed-hq Bot commented Aug 20, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 12.14%

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

⚡ 3 improved benchmarks
✅ 1978 untouched benchmarks
⏩ 42 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime words_gather_scalar[65536] 9.4 µs 8.2 µs +13.74%
Simulation cold_misaligned[(16, 64)] 428.3 µs 382.1 µs +12.09%
Simulation compress_fsst[(500, 64, 8)] 585.9 µs 529.6 µs +10.62%

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/row-fn-filter-scatter (685e0d2) with develop (fd538ff)2

Open in CodSpeed

Footnotes

  1. 42 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 (951cdf7) during the generation of this report, so fd538ff was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@connortsui20
connortsui20 force-pushed the ct/row-fn-filter-scatter branch 4 times, most recently from 2268a7d to 84b879d Compare August 20, 2026 20:50
@connortsui20
connortsui20 marked this pull request as ready for review August 20, 2026 20:51
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
@connortsui20
connortsui20 force-pushed the ct/row-fn-filter-scatter branch from 84b879d to b6c09be Compare August 20, 2026 20:57
@joseph-isaacs

Copy link
Copy Markdown
Contributor

Can you merge this with the next pr so we can see if this is the best approach

@connortsui20

Copy link
Copy Markdown
Member Author

@joseph-isaacs this is not about being a better approach, it's that we literally cannot support spatial with rowfn without this

let me update the pr description to include more detail

Comment thread vortex-array/src/scalar_fn/unstable/row/batch/execute/filter_scatter.rs Outdated
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
@connortsui20
connortsui20 marked this pull request as draft August 21, 2026 16:03
@connortsui20

Copy link
Copy Markdown
Member Author

im actually going to hold off on this until we can figure out how we want to deal with @HarukiMoriarty's work

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