Skip to content

Generate the constructors of the temporal cell indexes - #496

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:codegen/cell-instant-constructors
Oct 24, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:codegen/cell-instant-constructors

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

The constructors of tquadbin, th3index and ts2cell from a cell and a time value are generated from the catalog: the groups meos_quadbin_constructor, meos_h3_constructor and meos_s2cell_constructor are retired beside meos_temporal_constructor and the other family constructors. Each signature MobilityDB declares registers once, under its own name, argument types and result: tquadbin, th3index and ts2cell over their cell and a timestamptz (tquadbininst_make, th3indexinst_make, ts2cellinst_make), a tstzset and a tstzspan (the seq_from_base_ functions) and a tstzspanset (the *seqset_from_base_tstzspanset functions). shape_sig_call reads a SQL span set argument as it reads a span: sig_call_arg takes its DuckDB type from SPANSET_TYPES beside the span, base and set types, which reaches the three span set forms and no other signature.

The hand tquadbin(quadbin, timestamptz) of src/quadbin/tquadbin.cpp, the generated tquadbininst_make replacing it, is deleted with its executor Tquadbin_make and QuadbinTypes::RegisterScalarFunctions, which held nothing else; the quadbin and tquadbin types and their text casts stay, as for h3index and th3index.

Measured: on main th3index(h3index, timestamptz), ts2cell(s2cell, timestamptz) and the span set forms of all three register nothing, hand or generated. The generator emits 12 registrations more, the four constructors of each of the three cell types, and changes no other line of src/generated; a second run reproduces it byte for byte. test/sql/tquadbin.test, th3index.test and ts2cell.test read each constructor against the literal of the answer MobilityDB's regression suite gives for the same call (352_tquadbin, 270_th3index, 603_ts2cell). The build has no warning in the lines this change writes, and the suite passes, 4908 assertions in 121 test cases.

The constructors of tquadbin, th3index and ts2cell from a cell and a time value are generated from the catalog: the groups meos_quadbin_constructor, meos_h3_constructor and meos_s2cell_constructor are retired beside meos_temporal_constructor and the other family constructors. Each signature MobilityDB declares registers once, under its own name, argument types and result: tquadbin, th3index and ts2cell over their cell and a timestamptz (tquadbininst_make, th3indexinst_make, ts2cellinst_make), a tstzset and a tstzspan (the *seq_from_base_* functions) and a tstzspanset (the *seqset_from_base_tstzspanset functions). shape_sig_call reads a SQL span set argument as it reads a span: sig_call_arg takes its DuckDB type from SPANSET_TYPES beside the span, base and set types, which reaches the three span set forms and no other signature.

The hand tquadbin(quadbin, timestamptz) of src/quadbin/tquadbin.cpp, the generated tquadbininst_make replacing it, is deleted with its executor Tquadbin_make and QuadbinTypes::RegisterScalarFunctions, which held nothing else; the quadbin and tquadbin types and their text casts stay, as for h3index and th3index.

Measured: on main th3index(h3index, timestamptz), ts2cell(s2cell, timestamptz) and the span set forms of all three register nothing, hand or generated. The generator emits 12 registrations more, the four constructors of each of the three cell types, and changes no other line of src/generated; a second run reproduces it byte for byte. test/sql/tquadbin.test, th3index.test and ts2cell.test read each constructor against the literal of the answer MobilityDB's regression suite gives for the same call (352_tquadbin, 270_th3index, 603_ts2cell). The build has no warning in the lines this change writes, and the suite passes, 4908 assertions in 121 test cases.
@estebanzimanyi
estebanzimanyi merged commit 83d1036 into MobilityDB:main Oct 24, 2026
9 checks passed
@estebanzimanyi
estebanzimanyi deleted the codegen/cell-instant-constructors branch October 24, 2026 16:02
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