feat(vortex-geo): geometry Bbox zone-map statistic + distance-filter pruning#8646
Open
HarukiMoriarty wants to merge 1 commit into
Open
feat(vortex-geo): geometry Bbox zone-map statistic + distance-filter pruning#8646HarukiMoriarty wants to merge 1 commit into
Bbox zone-map statistic + distance-filter pruning#8646HarukiMoriarty wants to merge 1 commit into
Conversation
Merging this PR will not alter performance
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
…-filter pruning Add a `GeometryBounds` aggregate that computes a per-chunk 2D minimum bounding rectangle (`Struct<xmin, ymin, xmax, ymax>`) for native geometry columns and stores it as a zone-map statistic, plus a `GeoDistanceBoundsPrune` stats-rewrite rule that skips a chunk when its MBR is disjoint from a `GeoDistance(geom, const) <= r` query box. - vortex-array: aggregates self-declare as default zone stats via a `zone_stat_default` vtable/plugin hook; the zoned writer discovers them from the session registry in deterministic (id-sorted) order. - vortex-geo: `GeometryBounds` covers every native geometry type (Point, LineString, MultiPoint, Polygon, MultiLineString, MultiPolygon). All native storage is `List^n<Struct<x, y, ..>>`, so a single generic peel over the `List` levels extracts the vertices without per-type dispatch. The prune rule guards on `is_native_geometry`, ignores a NaN radius, and only handles the near forms `<=` / `<`. Missing stats bind to null, so older files degrade to no pruning. - vortex-bench: Morton-sort each generated SpatialBench table by its geometry column's bounding-box center so every lane (parquet, vortex-WKB, vortex-geo-native) reads spatially-clustered data and the zone-map prune can actually skip chunks. Idempotent via a parquet marker; stale derived vortex files from pre-sort parquet are deleted so the existence-keyed conversions regenerate. Signed-off-by: Nemo Yu <zyu379@wisc.edu>
22d686f to
9b5a017
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds spatial chunk-pruning to Vortex. A new
GeometryBoundsaggregate stores a per-chunk minimum bounding box (MBR) as a zone-map statistic, and a stats-rewrite rule uses it to skip chunks that cannot satisfy aST_Distance(geom, const) <= rfilter.Limitation
<=/<are pruned.>/>=are soundly prunable via the symmetric farthest-corner bound but are intentionally omitted (rarely?)Testing
8 new vortex-geo tests. Point bbox across batches; Polygon bbox over all ring vertices, empty group → null, and registry self-declaration. only <=/< prune while >/>=/==/!= don't (parameterized), distance symmetry, non-distance comparisons ignored, and an end-to-end falsify.
Performance
SF=1
SF=3
SF=10
Takeaway: when the data is pre-sorted, the bounding box pruning can significantly reduce the intermediate results DuckDB read in, make Q1 and Q3 significantly faster