Register the S2 cell index family - #351
Merged
estebanzimanyi merged 1 commit intoAug 28, 2026
Merged
Conversation
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.
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.
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.