Repository navigation
Register the H3 cell set as every set type is registered - #465
Merged
estebanzimanyi merged 1 commit intoOct 18, 2026
Merged
Conversation
h3indexset is generated from the catalog's MeosType enum (T_H3INDEXSET) with the other set types:
tools/codegen_duck_udfs.py lists h3index in BASE_ORDER, beside quadbin and s2cell, with
H3indexTypes::h3index() as its element type, so SetTypes::h3indexset() registers the type, its
casts to and from VARCHAR, set(h3index) and set(h3index[]), and the generic set surface;
H3indexTypes declares the cell and the temporal cell, h3index and th3index. The registrations the catalog states over it
gain asText, getValues and the two hexadecimal WKB readers, and the H3 prefilter shapes
(geoToH3IndexSet, eEqual(h3indexset, th3index)) name the generated type.
Witness: on main `SELECT setUnionAgg(v)::VARCHAR FROM (VALUES ('8a2a1072b59ffff'::h3index),
('8a2a1072b597fff'::h3index)) t(v)` answers the raw bytes of the set, `\xE0\x01\x00\x00ED...`,
DuckDB's cast of a BLOB, where MobilityDB answers {"8a2a1072b597fff", "8a2a1072b59ffff"}; here
MobilityDuck answers MobilityDB's text.
Measured: over the catalog at MobilityDB f058a27e4a, the pin, the unchanged generator reproduces
the committed surface with no difference; the changed one registers 8363 functions, types and
casts against 8359: the type and four functions over h3indexset added, and the generated
set(h3index) left to the one SetTypes registers for every set type.
test/sql/th3index.test states an h3indexset read as text, through asText, from getValues and
from setUnionAgg against the text MobilityDB answers for the same values.
Why: an h3indexset was the one set type registered by hand, without the cast to VARCHAR every
generated set type takes, so DuckDB showed it as its bytes wherever a VARCHAR is wanted.
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.
h3indexset is generated from the catalog's MeosType enum (T_H3INDEXSET) with the other set types:
tools/codegen_duck_udfs.py lists h3index in BASE_ORDER, beside quadbin and s2cell, with
H3indexTypes::h3index() as its element type, so SetTypes::h3indexset() registers the type, its
casts to and from VARCHAR, set(h3index) and set(h3index[]), and the generic set surface;
H3indexTypes declares the cell and the temporal cell, h3index and th3index. The registrations the catalog states over it
gain asText, getValues and the two hexadecimal WKB readers, and the H3 prefilter shapes
(geoToH3IndexSet, eEqual(h3indexset, th3index)) name the generated type.
Witness: on main
SELECT setUnionAgg(v)::VARCHAR FROM (VALUES ('8a2a1072b59ffff'::h3index), ('8a2a1072b597fff'::h3index)) t(v)answers the raw bytes of the set,\xE0\x01\x00\x00ED...,DuckDB's cast of a BLOB, where MobilityDB answers {"8a2a1072b597fff", "8a2a1072b59ffff"}; here
MobilityDuck answers MobilityDB's text.
Measured: over the catalog at MobilityDB f058a27e4a, the pin, the unchanged generator reproduces
the committed surface with no difference; the changed one registers 8363 functions, types and
casts against 8359: the type and four functions over h3indexset added, and the generated
set(h3index) left to the one SetTypes registers for every set type.
test/sql/th3index.test states an h3indexset read as text, through asText, from getValues and
from setUnionAgg against the text MobilityDB answers for the same values.
Why: an h3indexset was the one set type registered by hand, without the cast to VARCHAR every
generated set type takes, so DuckDB showed it as its bytes wherever a VARCHAR is wanted.