Repository navigation
State what a wrapper passes for a C parameter its SQL signature omits - #212
Merged
estebanzimanyi merged 1 commit intoOct 26, 2026
Merged
estebanzimanyi merged 1 commit into
estebanzimanyi merged 1 commit into
Conversation
The catalog states the value a MobilityDB wrapper passes for a C parameter the SQL signature leaves out, and the order of the SQL arguments, where the wrapper writes them in forms parser/boundargs.py did not read. A wrapper's own choice of a value by the number of arguments, bool segmentize = (PG_NARGS() == 2) ? PG_GETARG_BOOL(1) : false, reads as an inlined helper's does (_nargs_choices), and a literal behind a comment naming its parameter, union_tpcbox_tpcbox(a, b, /* strict */ false), reads as the literal. A shared helper a wrapper delegates to reads as the wrapper's call makes it run (_specialize): each flag the call passes stands in the helper, the tests and choices it decides keep their branch alone, a function-pointer parameter calls the function the wrapper hands it (Raster_terrain_index(fcinfo, false, &raster_tpi)), a running index, PG_GETARG_FLOAT8(i++), numbers the arguments read by read, a branch reading one argument in each arm included, and an index assigned once adds into the argument it offsets. A local the call leaves at its literal initialiser binds that literal, a declaration of several locals ending each initialiser at its comma, and the SQL argument order of a delegating wrapper is read in the helper as specialised. The helper reader closes a parameter list at its balanced parenthesis, so a helper taking a function pointer is read. Witness: over the catalog derived from MobilityDB 7b6f72c037, the typed Spark and Flink surfaces of JMEOS main refuse stboxX(float, float, float, float, integer), whose wrapper reads xmin, ymin, xmax, ymax and srid through Stbox_constructor(fcinfo, true, false, false, false), while stbox_make takes srid, xmin, xmax, ymin, ymax, then zmin, zmax and the period the helper leaves at 0, 0 and NULL. With this parser the signature binds zmin 0, zmax 0 and s NULL and states its order xmin, ymin, xmax, ymax, srid, so a binding pairs each argument with its parameter by name. Measured: over MobilityDB 7b6f72c037, the catalog changes in 38 of 6724 functions against master's parser, every change a value the wrapper passes or an order it reads: stbox_make in 11 signatures (the constants and the order), tpoint_tfloat_to_geomeas (segmentize false for one argument), union_tpcbox_tpcbox (strict false), jsonbset_set and tjsonb_set (the null treatment NULL), raster_tpi and raster_tri (the extent NULL), tnumber_value_time_boxes (no duration or time origin for the value boxes), the ever and always spatial relationships of the temporal geometries and circular buffers (ever EVER or ALWAYS, read through their function-pointer helper), and four commuted orders of edwithin, adwithin, teq and tne. The typed surfaces register 14 more user-facing signatures and refuse none they registered: the stbox and geodstbox constructors but their timestamp forms, geometry(tgeompoint), geography(tgeogpoint), jsonbsetSet, tjsonbSet, tpcboxUnion, tpi and tri. The six new tests fail on master's parser; tests/test_boundargs.py passes 69, and the suite fails the three tests it fails on master in this environment, which CI passes. Why: a binding generated from the catalog passes what the wrapper passes, and pairs the SQL arguments with the C parameters by name, only where the catalog states both.
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.
The catalog states the value a MobilityDB wrapper passes for a C parameter the SQL signature
leaves out, and the order of the SQL arguments, where the wrapper writes them in forms
parser/boundargs.py did not read. A wrapper's own choice of a value by the number of arguments,
bool segmentize = (PG_NARGS() == 2) ? PG_GETARG_BOOL(1) : false, reads as an inlined helper's
does (_nargs_choices), and a literal behind a comment naming its parameter,
union_tpcbox_tpcbox(a, b, /* strict */ false), reads as the literal. A shared helper a wrapper
delegates to reads as the wrapper's call makes it run (_specialize): each flag the call passes
stands in the helper, the tests and choices it decides keep their branch alone, a
function-pointer parameter calls the function the wrapper hands it (Raster_terrain_index(fcinfo,
false, &raster_tpi)), a running index, PG_GETARG_FLOAT8(i++), numbers the arguments read by read,
a branch reading one argument in each arm included, and an index assigned once adds into the
argument it offsets. A local the call leaves at its literal initialiser binds that literal, a
declaration of several locals ending each initialiser at its comma, and the SQL argument order
of a delegating wrapper is read in the helper as specialised. The helper reader closes a
parameter list at its balanced parenthesis, so a helper taking a function pointer is read.
Witness: over the catalog derived from MobilityDB 7b6f72c037, the typed Spark and Flink
surfaces of JMEOS main refuse stboxX(float, float, float, float, integer), whose wrapper reads
xmin, ymin, xmax, ymax and srid through Stbox_constructor(fcinfo, true, false, false, false),
while stbox_make takes srid, xmin, xmax, ymin, ymax, then zmin, zmax and the period the helper
leaves at 0, 0 and NULL. With this parser the signature binds zmin 0, zmax 0 and s NULL and
states its order xmin, ymin, xmax, ymax, srid, so a binding pairs each argument with its
parameter by name.
Measured: over MobilityDB 7b6f72c037, the catalog changes in 38 of 6724 functions against
master's parser, every change a value the wrapper passes or an order it reads: stbox_make in 11
signatures (the constants and the order), tpoint_tfloat_to_geomeas (segmentize false for one
argument), union_tpcbox_tpcbox (strict false), jsonbset_set and tjsonb_set (the null treatment
NULL), raster_tpi and raster_tri (the extent NULL), tnumber_value_time_boxes (no duration or
time origin for the value boxes), the ever and always spatial relationships of the temporal
geometries and circular buffers (ever EVER or ALWAYS, read through their function-pointer
helper), and four commuted orders of edwithin, adwithin, teq and tne. The typed surfaces
register 14 more user-facing signatures and refuse none they registered: the stbox and
geodstbox constructors but their timestamp forms, geometry(tgeompoint), geography(tgeogpoint),
jsonbsetSet, tjsonbSet, tpcboxUnion, tpi and tri. The six new tests fail on master's parser;
tests/test_boundargs.py passes 69, and the suite fails the three tests it fails on master in
this environment, which CI passes.
Why: a binding generated from the catalog passes what the wrapper passes, and pairs the SQL
arguments with the C parameters by name, only where the catalog states both.