Skip to content

State what a wrapper passes for a C parameter its SQL signature omits - #212

Merged
estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:catalog/omitted-params-bound
Oct 26, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:catalog/omitted-params-bound

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

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.

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.
@estebanzimanyi
estebanzimanyi merged commit 7b1d231 into MobilityDB:master Oct 26, 2026
3 of 4 checks passed
@estebanzimanyi
estebanzimanyi deleted the catalog/omitted-params-bound branch October 26, 2026 17:40
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