Skip to content

Add static-geometry to h3indexset prefilter UDFs#131

Draft
estebanzimanyi wants to merge 1 commit into
feat/parity-th3indexfrom
feat/parity-h3-static-prefilter
Draft

Add static-geometry to h3indexset prefilter UDFs#131
estebanzimanyi wants to merge 1 commit into
feat/parity-th3indexfrom
feat/parity-h3-static-prefilter

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

Summary

Adds the two MobilityDuck UDFs that complete the h3 prefilter surface for trip × static-geometry cross-join queries (BerlinMOD Q4, Q7, Q11, Q12, Q15, Q17):

  • `geoToH3IndexSet(GEOMETRY, INTEGER) → H3INDEXSET` — covers POINT / LINESTRING / POLYGON / MULTI* / GeomCollection. Caller passes geometry in EPSG:4326.
  • `everIntersectsH3IndexSet_Th3Index(H3INDEXSET, TH3INDEX) → BOOLEAN` — true when the trajectory's H3 cell sequence ever equals any cell of the static set.

`H3INDEXSET` is a new logical type (alias on `BLOB`), storing a serialized MEOS `Set`.

Stacks on PR #129 (the th3index core).

Validation

BerlinMOD scalefactor 0.005 on a single-node DuckDB build, Q7-style intersection (every trip × every QueryPoint):

Variant Wall time
`ST_Intersects(trajectory(t.trip), p.geom)` baseline 0.517 s
Same predicate with `everIntersectsH3IndexSet_Th3Index` prefilter 0.076 s
Speedup 6.8×

Test plan

  • CI green on the org repo matrix
  • Smoke test on BerlinMOD sf 0.005 — h3 prefilter cuts the Q7-shape cross-join wall time from 0.517 s to 0.076 s

@estebanzimanyi

Copy link
Copy Markdown
Member Author

Reviewer's quickstart — ~2-3 minutes

What this PR does: Add static-geometry to h3indexset prefilter UDFs.

Risk: focused, single-purpose. Spot-check the source diff + matching tests; CI confirms.

Cross-link: Linux arm64 CI here needs #161 for the orthogonal MeosType build error.

estebanzimanyi added a commit to estebanzimanyi/MobilityDuck that referenced this pull request May 25, 2026
Bump the vcpkg meos pin dfdd2554 -> bb659c693 (MobilityDB accumulate/parity-1.4,
PR MobilityDB#22) so the extension links the h3indexset static-geometry API
(geo_to_h3index_set, ever_eq_anyof_h3indexset_th3index) and the extended-type C
API (tcbuffer_from_mfjson, ...) — the universal unblock for the th3 prefilter
UDFs (MobilityDB#131) and the extended-type ports.

Adapt the binding to the bb659c693 API:
- geo_as_ewkb(gs, endian, &n) -> geo_as_wkb(gs, WKB_EXTENDED, &n) (the WKB/EWKB
  consolidation to a variant parameter).
- temptype_supports_linear -> temptype_continuous.
- mult_* -> mul_* (temporal multiplication naming normalization).

Reconcile 3 expected outputs to bb659c693's verified reference behaviour:
- span -|- adjacency is now set-theoretic share-a-boundary (closed spans meeting
  at a boundary are adjacent): 1.0 -|- floatspan[1,3] (both directions) and the
  tint/tstzspan boundary case -> true (matches MobilityDB's own 005 test).
- ln/log10/exp lifts no longer insert an interior turning point; results keep
  the input instant count (matches MobilityDB's 026 test).

Build + full sqllogictest green (1727 assertions, 76 cases).
estebanzimanyi added a commit to estebanzimanyi/MobilityDuck that referenced this pull request May 25, 2026
Register the H3INDEXSET type plus geoToH3IndexSet and
everIntersectsH3IndexSet_Th3Index, backed by the MEOS geo_to_h3index_set /
ever_eq_anyof_h3indexset_th3index API now available after the MEOS pin bump.
These are the static-geometry H3 prefilter UDFs the portable BerlinMOD th3
queries (q02/q04/q05/q06/q10/q16) rely on. They register via the existing
H3IndexTypes::Register* calls (no new wiring). Build + full suite green (1727).

Folds open PR MobilityDB#131 (now unblocked by the MEOS pin bump).
@estebanzimanyi estebanzimanyi force-pushed the feat/parity-th3index branch 3 times, most recently from 961b2c7 to 8181399 Compare June 5, 2026 18:42
@estebanzimanyi estebanzimanyi force-pushed the feat/parity-h3-static-prefilter branch 4 times, most recently from dabdbcd to d9b2ab6 Compare June 6, 2026 04:47
@estebanzimanyi estebanzimanyi force-pushed the feat/parity-th3index branch from 504e1ba to dee2e01 Compare June 6, 2026 04:48
@estebanzimanyi estebanzimanyi force-pushed the feat/parity-h3-static-prefilter branch from d9b2ab6 to 96503a1 Compare June 6, 2026 06:10
@estebanzimanyi estebanzimanyi force-pushed the feat/parity-th3index branch from dee2e01 to 37107d1 Compare June 6, 2026 06:10
@estebanzimanyi estebanzimanyi force-pushed the feat/parity-h3-static-prefilter branch from 96503a1 to 2aa1f8a Compare June 6, 2026 06:35
@estebanzimanyi estebanzimanyi force-pushed the feat/parity-th3index branch 2 times, most recently from 3ec3ee9 to ade75e5 Compare June 6, 2026 07:15
@estebanzimanyi estebanzimanyi force-pushed the feat/parity-h3-static-prefilter branch from 2aa1f8a to 63d1b2a Compare June 6, 2026 07:15
Expose the static-geometry h3indexset prefilter that narrows a th3index
candidate set before the exact spatial test. The trip x static cell-set
predicate derives the canonical ?= / ever_eq surface, registered as the
everEq comparison overload in both argument directions and backed by the
ever_eq_h3indexset_th3index kernel, with geoToH3IndexSet building the
static side.
@estebanzimanyi estebanzimanyi force-pushed the feat/parity-th3index branch from ade75e5 to 72b53b2 Compare June 6, 2026 20:25
@estebanzimanyi estebanzimanyi force-pushed the feat/parity-h3-static-prefilter branch from 63d1b2a to 24f947a Compare June 6, 2026 20:25
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