Skip to content

feat(parity): stboxes / splitNStboxes / splitEachNStboxes — multi-entry bbox emitters#127

Open
estebanzimanyi wants to merge 1 commit intomainfrom
feat/parity-stboxes-emitters
Open

feat(parity): stboxes / splitNStboxes / splitEachNStboxes — multi-entry bbox emitters#127
estebanzimanyi wants to merge 1 commit intomainfrom
feat/parity-stboxes-emitters

Conversation

@estebanzimanyi
Copy link
Copy Markdown
Member

Summary

Adds the multi-entry bbox emitter family — required to build R-tree-style indexes on temporal trajectories or geometry collections in DuckDB:

Function Returns Purpose
`stboxes()` LIST(STBOX) one stbox per sequence
`splitNStboxes(, n)` LIST(STBOX) exactly n stboxes, distributed by element count
`splitEachNStboxes(, n)` LIST(STBOX) each stbox covers n consecutive instants

Each registered for tgeometry / tgeography / tgeompoint / tgeogpoint (temporal) and bare geometry / geography (non-temporal). 15 overloads total.

Why

Multi-entry indexes on temporal data (R-tree, GIST-style) need to break long trajectories into bbox shards so that bounding-box overlap predicates can prune efficiently before falling through to per-instant calculation. The three emitters are the canonical way to produce those shards. Without them, indexing a long trajectory degrades to O(n) per query — these emitters are essential.

Test plan

  • `test/sql/parity/060b_stboxes_emitters.test` — `len()` + accessor (`hasX` / `hasT` / `SRID`) assertions across all 3 emitters and all 4 temporal types + bare geometry, timezone-neutral.
  • CI green on `linux_amd64` and `linux_arm64`.

Depends on

…ry bbox emitters

Adds the multi-entry bbox emitter family that's required to build
R-tree-style indexes on temporal trajectories or geometry
collections in DuckDB:

- stboxes(<spatial>) → LIST(STBOX) — one stbox per sequence.
- splitNStboxes(<spatial>, n) → LIST(STBOX) — exactly n stboxes,
  distributed by element count.
- splitEachNStboxes(<spatial>, n) → LIST(STBOX) — each stbox covers
  n consecutive instants/elements of the input.

Each registered for tgeometry / tgeography / tgeompoint / tgeogpoint
(temporal) and bare geometry / geography (non-temporal).  15
overloads total.

Wraps the MEOS exports tgeo_stboxes / tgeo_split_n_stboxes /
tgeo_split_each_n_stboxes for the temporal forms and geo_stboxes /
geo_split_n_stboxes / geo_split_each_n_stboxes for the bare-geometry
forms.

User motivation: multi-entry indexes on temporal data (R-tree,
GIST-style) need to break long trajectories into bbox shards so
that bounding-box overlap predicates can prune efficiently before
falling through to the per-instant calculation.  The three emitters
are the canonical way to produce those shards.

Smoke test test/sql/parity/060b_stboxes_emitters.test exercises all
three emitters across tgeompoint / tgeometry / tgeography / bare
geometry with deterministic len() and hasX/hasT/SRID accessor
assertions — timezone-neutral.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant