Skip to content

Register the S2 cell index family - #351

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:feat/s2cell-family
Aug 28, 2026
Merged

Register the S2 cell index family#351
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:feat/s2cell-family

Conversation

@estebanzimanyi

@estebanzimanyi estebanzimanyi commented Aug 28, 2026

Copy link
Copy Markdown
Member

MobilityDB publishes the Google S2 spherical DGGS as s2cell, s2cellset and ts2cell, the third cell index beside h3index and quadbin. The binding names the family everywhere its siblings are named: the two DuckDB types and their text I/O in src/s2cell/ts2cell.cpp, the emit gate, the spatial supertype the generic Temporal surface reaches, the name scope, the conversion target, the catalog-signature accessor map, the base value order and element type, the Tcell cell-id pairing, the MEOS header the generated unit includes, and the binding header beside it. A cell reads and writes as its S2 hex token, s2cell_in and s2cell_out owning that spelling, so a value written the way MobilityDB writes it is the value DuckDB accepts.

The generator resolves the transparent MEOS typedefs the catalog leaves unresolved. S2CellId is uint64_t, meos_s2cell.h typedefing it from the uint64 that pg_basetypes.h typedefs from uint64_t, and the catalog renders that natively in the scalar positions while leaving the alias standing in the array and out-parameter ones. Resolving it once lets getValues and valueN generate for ts2cell exactly as they do for its tquadbin and th3index twins, rather than repeating the spelling in each of the four maps keyed on the native one.

The registration set moves by exactly those two rows with none removed, both typed s2cell[] and s2cell as the quadbin twin is. test/sql/ts2cell.test covers the type name, the hex-token round trip, the generic Temporal accessors, the comparison and the cell-id value accessors, every expected value taken from the built binary; the suite reports 2666 assertions in 101 test cases.

MobilityDB publishes the Google S2 spherical DGGS as s2cell, s2cellset and
ts2cell, the third cell index beside h3index and quadbin. The binding names
the family everywhere its siblings are named: the two DuckDB types and their
text I/O in src/s2cell/ts2cell.cpp, the emit gate, the spatial supertype the
generic Temporal surface reaches, the name scope, the conversion target, the
catalog-signature accessor map, the base value order and element type, the
Tcell cell-id pairing, the MEOS header the generated unit includes, and the
binding header it includes beside it.

A cell reads and writes as its S2 hex token, s2cell_in and s2cell_out owning
that spelling, so a value written the way MobilityDB writes it is the value
DuckDB accepts.

The generator resolves the transparent MEOS typedefs the catalog leaves
unresolved, so a family naming its own alias for a type the rest of the
surface spells natively reads as that native type. S2CellId is uint64_t --
meos_s2cell.h typedefs it from the uint64 that pg_basetypes.h typedefs from
uint64_t -- and s2cell spells the cell id natively in its scalar positions
and S2CellId only in the array and out-parameter ones, so resolving the alias
once is what lets getValues and valueN generate for ts2cell exactly as they
do for its tquadbin and th3index twins, rather than repeating the spelling in
each of the four maps keyed on the native one.

test/sql/ts2cell.test covers the type name, the hex-token round trip, the
generic Temporal accessors, the comparison and the cell-id value accessors.
@estebanzimanyi
estebanzimanyi merged commit c685dff into MobilityDB:main Aug 28, 2026
10 checks passed
@estebanzimanyi
estebanzimanyi deleted the feat/s2cell-family branch August 28, 2026 20:06
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