Skip to content

feat(vortex-spatial): add collect scalar function - #9218

Open
HarukiMoriarty wants to merge 7 commits into
developfrom
nemo/geo-collect
Open

feat(vortex-spatial): add collect scalar function#9218
HarukiMoriarty wants to merge 7 commits into
developfrom
nemo/geo-collect

Conversation

@HarukiMoriarty

@HarukiMoriarty HarukiMoriarty commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add strict homogeneous ST_Collect overloads for lists of Point, LineString, and Polygon
  • return the corresponding native MultiPoint, MultiLineString, or MultiPolygon type
  • use shared unary dispatch for constant handling and strict outer-null propagation
  • reuse geometry storage on the all-valid path and compact only nullable inner elements
  • add focused tests and a dedicated microbenchmark

@HarukiMoriarty HarukiMoriarty added the changelog/feature A new feature label Aug 5, 2026
@codspeed-hq

codspeed-hq Bot commented Aug 5, 2026

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

⚡ 2 improved benchmarks
❌ 1 regressed benchmark
✅ 1956 untouched benchmarks
🆕 5 new benchmarks
⏩ 89 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation cold_misaligned[(64, 256)] 4.4 ms 5.3 ms -16.88%
Simulation decode_varbin[(1000, 2)] 78.5 µs 62.4 µs +25.82%
Simulation compress_fsst[(1000, 64, 8)] 1.2 ms 1 ms +13.04%
🆕 Simulation linestrings N/A 167.1 µs N/A
🆕 Simulation nullable_points N/A 308.8 µs N/A
🆕 Simulation points N/A 165.3 µs N/A
🆕 Simulation polygons N/A 167.7 µs N/A
🆕 Simulation envelope_of_collected_points N/A 489.3 µs N/A

Tip

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


Comparing nemo/geo-collect (8153fd8) with develop (ff0a26d)

Open in CodSpeed

Footnotes

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

@HarukiMoriarty HarukiMoriarty changed the title feat(vortex-geo): add collect scalar function feat(vortex-spatial): add collect scalar function Aug 7, 2026
Base automatically changed from nemo/geo-area to develop August 10, 2026 17:46
Signed-off-by: Nemo Yu <zyu379@wisc.edu>
Signed-off-by: Nemo Yu <zyu379@wisc.edu>
Signed-off-by: Nemo Yu <zyu379@wisc.edu>
Return `ExtDTypeRef` from `collect_dtype` so `execute` stops unwrapping the
extension back out of a `DType` and no longer carries two names for one value,
matching how `convex_hull_dtype` resolves its output.

Fold the two element-type rejections into one match so the "not a native Point,
LineString, or Polygon" message has a single source, and take the output
nullability from the `Execution` the dispatcher already populated instead of
re-deriving it from the output dtype.

Signed-off-by: Nemo Yu <zyu379@wisc.edu>
`ListViewArray::try_new` always reports `is_zero_copy_to_list` as false, so the
list view collect handed back forgot that its views are still exact. The next
`list_from_list_view` then re-gathered the entire geometry payload that the
all-valid path had just reused, moving the copy one operator later instead of
avoiding it.

Forward the input's flag instead. The reuse path passes `offsets` and `sizes`
through untouched, and the compaction path rebuilds them as a running sum over
the same element order, so the zero-copy invariant holds on both; `validate_zctl`
checks it under debug assertions.

`ST_Envelope(ST_Collect(points))` over 512 rows of 8 points improves from
10.54us to 8.42us fastest and 10.72us to 8.54us median. The existing cases
cannot observe this because `Canonical`'s list form is itself a `ListViewArray`,
so add one that composes collect with a consumer converting to a `ListArray`.

Signed-off-by: Nemo Yu <zyu379@wisc.edu>
Signed-off-by: Nemo Yu <zyu379@wisc.edu>
Collapse the two parallel `compact_elements` branches in `collect_list_rows`
into one, which removes the derived flag, a mask clone, and a duplicated cast.

Extract the row-view rebuild into `compact_row_views` and drop its read of the
incoming offsets: compaction only runs after `MakeExact`, which leaves the views
a gapless in-order cover, so each row starts where the previous one ended. That
saves a cast and a full array execution per null-bearing batch.

Rename `execute_collect_list_rows` to `execute_collect` to match the sibling
`execute_envelope` and `execute_make_line`, and use one name, `element_mask`,
for the element validity throughout.

Add a test for a non-exact list view, the `MakeExact` path the offsets
derivation relies on and the only path no test covered.

Signed-off-by: Nemo Yu <zyu379@wisc.edu>
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.

1 participant