Keep a shared SQL signature on the function whose parameters it fits - #170
Merged
estebanzimanyi merged 1 commit intoOct 3, 2026
Conversation
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.
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.
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.