Skip to content

Map a parameter type by its canonical spelling and stop on an unknown one - #72

Merged
estebanzimanyi merged 2 commits into
masterfrom
gen/map-types-by-their-canonical-spelling
Nov 5, 2026
Merged

estebanzimanyi merged 2 commits into
masterfrom
gen/map-types-by-their-canonical-spelling

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

Build against MobilityDB master, without GEOS

catalog_gen.go and mathops_meos_gen.go are what tools/codegen writes from the MEOS-API catalog of MobilityDB master. In that catalog the temporal S2 cell carries the MF-JSON token MovingS2Cell, and tnumber_angular_difference carries no SQL name: the only SQL angularDifference functions take a temporal point or two floats, so no SQL function answers it for a temporal number. The math operations are therefore 21, of which 18 are callable from the cgo dispatch, and angularDifference is not among them. The test that holds the segment-walking operations out of the lifted set names the two the catalog states, derivative and trend, and the comment in stream.go and GENERATION.md says the same.

The MEOS output functions of MobilityDB master write the size of their result, terminating null included, through a size_t pointer they require. The cgo stream engine passes one to tfloat_out and text_out and reads each result by that size, and a lifted operation whose result tfloat_out cannot write answers an error instead of reading a null string.

MobilityDB master builds without GEOS: its CMake looks for no GEOS, the vendored PostGIS reads the geometry types from a stand-in geos_c.h under meos/include/geos-none, and MEOS creates no GEOS context. The CI installs no GEOS development package and no GDAL from apt, whose GDAL links GEOS: the test job takes GDAL and libmeos from MEOS-API's provision-meos action, which builds GDAL from its release source with GEOS off, builds libmeos with every family from the MobilityDB commit the job checks out, installs both under /usr/local, and fails if a GEOS library loads with libmeos. The action runs before the job installs PostgreSQL 18, so the PostgreSQL it installs for its own build goes with the job's removal step, and the extension compiles against the same GDAL. PostGIS, which the extension requires, keeps its own GEOS. The comment on the thread-local caches of the stream engine names PROJ and the random number generators as the ones MEOS creates per thread.

Witness. go vet, go build and go test, with and without the meos tag, pass against a libmeos built from MobilityDB 91c37c37cd, and the generator rewrites both tables unchanged from the catalog of that commit.

Map a parameter type by its canonical spelling and stop on an unknown one

tools/codegen reads each parameter's canonical spelling from the MEOS-API catalog, the C spelling with every typedef the catalog states resolved, and fills the one further parameter of a math operation by that spelling: argConversions fills a double, an int and a bool, so a typedef the catalog resolves to one of them is filled as that type. argUnfillable states the two types the one value of a query cannot fill, const Interval * and interpType, each with its reason, and an operation taking one keeps its row in mathOps and gets no case in the cgo dispatch. A parameter whose canonical spelling is absent, or names a type in neither map, stops the generator with an error naming the function and the type, so a type the catalog gives a parameter reaches the tier as a failing check rather than as an operation missing from the dispatch.

Measured. Over the catalog of MobilityDB master the generator selects 21 math operations and serves 18, the operations and cases of master's tables, whose generated dispatch differs only in the header comment naming the two unfillable types; the three without a case are the two taking an interval and the one taking an interpolation.

Witness. tools/codegen/main_test.go builds catalog entries and asserts that an int32 parameter whose canonical spelling is int is filled as an int, that an interval parameter keeps its operation out of the dispatch, and that a parameter of an unknown type, or one without a canonical spelling, stops the generator naming the function. GENERATION.md states the rule.

catalog_gen.go and mathops_meos_gen.go are what tools/codegen writes from the MEOS-API catalog of MobilityDB master. In that catalog the temporal S2 cell carries the MF-JSON token MovingS2Cell, and tnumber_angular_difference carries no SQL name: the only SQL angularDifference functions take a temporal point or two floats, so no SQL function answers it for a temporal number. The math operations are therefore 21, of which 18 are callable from the cgo dispatch, and angularDifference is not among them. The test that holds the segment-walking operations out of the lifted set names the two the catalog states, derivative and trend, and the comment in stream.go and GENERATION.md says the same.

The MEOS output functions of MobilityDB master write the size of their result, terminating null included, through a size_t pointer they require. The cgo stream engine passes one to tfloat_out and text_out and reads each result by that size, and a lifted operation whose result tfloat_out cannot write answers an error instead of reading a null string.

MobilityDB master builds without GEOS: its CMake looks for no GEOS, the vendored PostGIS reads the geometry types from a stand-in geos_c.h under meos/include/geos-none, and MEOS creates no GEOS context. The CI installs no GEOS development package and no GDAL from apt, whose GDAL links GEOS: the test job takes GDAL and libmeos from MEOS-API's provision-meos action, which builds GDAL from its release source with GEOS off, builds libmeos with every family from the MobilityDB commit the job checks out, installs both under /usr/local, and fails if a GEOS library loads with libmeos. The action runs before the job installs PostgreSQL 18, so the PostgreSQL it installs for its own build goes with the job's removal step, and the extension compiles against the same GDAL. PostGIS, which the extension requires, keeps its own GEOS. The comment on the thread-local caches of the stream engine names PROJ and the random number generators as the ones MEOS creates per thread.

Witness. go vet, go build and go test, with and without the meos tag, pass against a libmeos built from MobilityDB 91c37c37cd, and the generator rewrites both tables unchanged from the catalog of that commit.
… one

tools/codegen reads each parameter's canonical spelling from the MEOS-API catalog, the C spelling with every typedef the catalog states resolved, and fills the one further parameter of a math operation by that spelling: argConversions fills a double, an int and a bool, so a typedef the catalog resolves to one of them is filled as that type. argUnfillable states the two types the one value of a query cannot fill, const Interval * and interpType, each with its reason, and an operation taking one keeps its row in mathOps and gets no case in the cgo dispatch. A parameter whose canonical spelling is absent, or names a type in neither map, stops the generator with an error naming the function and the type, so a type the catalog gives a parameter reaches the tier as a failing check rather than as an operation missing from the dispatch.

Measured. Over the catalog of MobilityDB master the generator selects 21 math operations and serves 18, the operations and cases of master's tables, whose generated dispatch differs only in the header comment naming the two unfillable types; the three without a case are the two taking an interval and the one taking an interpolation.

Witness. tools/codegen/main_test.go builds catalog entries and asserts that an int32 parameter whose canonical spelling is int is filled as an int, that an interval parameter keeps its operation out of the dispatch, and that a parameter of an unknown type, or one without a canonical spelling, stops the generator naming the function. GENERATION.md states the rule.
@estebanzimanyi
estebanzimanyi merged commit cafcd8f into master Nov 5, 2026
2 checks passed
@estebanzimanyi
estebanzimanyi deleted the gen/map-types-by-their-canonical-spelling branch November 5, 2026 21: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