Skip to content

Keep a shared SQL signature on the function whose parameters it fits - #170

Merged
estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:catalog/claims-fit-their-parameters
Oct 3, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:catalog/claims-fit-their-parameters

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

attach_claims_fit, run once the object model and the type relations are attached, gathers the
SQL signatures two or more public functions claim; where the arguments of one fit the C input
parameters of a claimant, in their order or the one other order a wrapper passes them in, with
the bound parameters and the out-parameters taking no argument, as _Resolver.params of
parser/compositions.py matches a call, every claimant whose parameters they do not fit gives
it up. A signature no claimant or every claimant fits stays where it is, a signature one
function claims is untouched, and a function left with signatures under another name takes
that name as its sqlfn. test_claims_fit.py states the typed kernels of one box wrapper, a bound
parameter, and the three cases left alone.

Witness: Tbox_value_tiles backs valueTiles over tbox with integer, bigint and float sizes, and
tintbox_value_tiles, tbigintbox_value_tiles and tfloatbox_value_tiles each claimed all three
signatures, since the type scope that chose them names the box they all take. A binding
calls the first claimant it meets: the Spark SQL surface answered
valueTiles(tbox(tint), 1, 0, true) through tbigintbox_value_tiles, which raised "The span must
be of type bigintspan". teq_bool_tbool claimed tEqual(integer, tint) the same way.

Why: a binding names the C function of a signature from the catalog alone, so a signature
claimed by a function whose parameters it does not fit sends the call to the wrong kernel, and
a Java int widening to a long or a double hides the mismatch from the compiler.

Measured: over MobilityDB 43cfd3f936 the catalog gives up 48 signatures across 15 functions:
the value tiles, expand, shift and scale functions of the int, bigint and float boxes, the
tEqual and tNotEqual of tbool beside the other base types, aDisjoint(tcbuffer, geometry) on
adisjoint_tcbuffer_cbuffer and cellToChildren(quadbin, integer) on quadbin_cell_to_children;
no other field of any function changes. pytest tests/ answers 473 passed and 11 skipped with
MDB_SRC_ROOT set.

attach_claims_fit, run once the object model and the type relations are attached, gathers the
SQL signatures two or more public functions claim; where the arguments of one fit the C input
parameters of a claimant, in their order or the one other order a wrapper passes them in, with
the bound parameters and the out-parameters taking no argument, as _Resolver.params of
parser/compositions.py matches a call, every claimant whose parameters they do not fit gives
it up. A signature no claimant or every claimant fits stays where it is, a signature one
function claims is untouched, and a function left with signatures under another name takes
that name as its sqlfn. test_claims_fit.py states the typed kernels of one box wrapper, a bound
parameter, and the three cases left alone.

Witness: Tbox_value_tiles backs valueTiles over tbox with integer, bigint and float sizes, and
tintbox_value_tiles, tbigintbox_value_tiles and tfloatbox_value_tiles each claimed all three
signatures, since the type scope that chose them names the box they all take. A binding
calls the first claimant it meets: the Spark SQL surface answered
valueTiles(tbox(tint), 1, 0, true) through tbigintbox_value_tiles, which raised "The span must
be of type bigintspan". teq_bool_tbool claimed tEqual(integer, tint) the same way.

Why: a binding names the C function of a signature from the catalog alone, so a signature
claimed by a function whose parameters it does not fit sends the call to the wrong kernel, and
a Java int widening to a long or a double hides the mismatch from the compiler.

Measured: over MobilityDB 43cfd3f936 the catalog gives up 48 signatures across 15 functions:
the value tiles, expand, shift and scale functions of the int, bigint and float boxes, the
tEqual and tNotEqual of tbool beside the other base types, aDisjoint(tcbuffer, geometry) on
adisjoint_tcbuffer_cbuffer and cellToChildren(quadbin, integer) on quadbin_cell_to_children;
no other field of any function changes. pytest tests/ answers 473 passed and 11 skipped with
MDB_SRC_ROOT set.
@estebanzimanyi
estebanzimanyi merged commit ba9a3ee into MobilityDB:master Oct 3, 2026
3 checks passed
@estebanzimanyi
estebanzimanyi deleted the catalog/claims-fit-their-parameters branch October 3, 2026 14:10
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