Skip to content

Pass the arguments of a shorter call in the order the catalog states for the function - #191

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:codegen/shorter-call-takes-the-function-order
Oct 25, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:codegen/shorter-call-takes-the-function-order

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

The call leaving an argument to its NULL default drops that argument from the order the SQL arguments take, and _sql_overloads of tools/codegen_jvm.py hands _null_default_signatures that order whether the catalog states it for the signature or for the whole function, in shape.sqlArgParams. tfloatSeqSetGaps(tfloat[], maxt interval DEFAULT NULL, maxdist float DEFAULT NULL, interp text DEFAULT 'linear') reads its arguments in the order instants, maxt, maxdist, interp, which tsequenceset_make_gaps takes as instants, interp, maxt, maxdist, so tfloatSeqSetGaps(tfloat[], interval) passes its interval to maxt, -1.0 to maxdist and 'linear' to interp, as the wrapper does; raster(pixels, width, ...) without its nodata value passes its pixels last, 0.0 to nodataval and false to has_nodata.

Witness: over MobilityDB master bc6f2729ea and MEOS-API master 71c23da, main's generator answers each SeqSetGaps on the typed Spark and Flink surfaces with the call stating the interval and the distance and the call stating the instants alone, and with no call stating the instants and the interval, and registers neither raster nor raquet: the shorter signature takes the order of the full one, which states arguments it does not, so it pairs nothing and is dropped.

Measured over the same pair with the jar built from that catalog and that libmeos: the Spark SQL and Flink SQL surfaces each answer 1302 SQL functions and 9361 overloads where main's answer 1300 and 9349, the 12 more the call of SeqSetGaps stating the instants and the interval for its 10 temporal types, raster without its nodata value and raquet without its nodata value, and every other generated file is identical. codegen/src/test/java/JvmShorterCallOrderTest.java runs the generator over a function whose SQL arguments come in another order than its C parameters: on main the call leaving its last argument out is missing on both surfaces, and here it passes its arguments to the parameters they stand for and the default to the one it leaves out.

…for the function

The call leaving an argument to its NULL default drops that argument from the order the SQL arguments take, and _sql_overloads of tools/codegen_jvm.py hands _null_default_signatures that order whether the catalog states it for the signature or for the whole function, in shape.sqlArgParams. tfloatSeqSetGaps(tfloat[], maxt interval DEFAULT NULL, maxdist float DEFAULT NULL, interp text DEFAULT 'linear') reads its arguments in the order instants, maxt, maxdist, interp, which tsequenceset_make_gaps takes as instants, interp, maxt, maxdist, so tfloatSeqSetGaps(tfloat[], interval) passes its interval to maxt, -1.0 to maxdist and 'linear' to interp, as the wrapper does; raster(pixels, width, ...) without its nodata value passes its pixels last, 0.0 to nodataval and false to has_nodata.

Witness: over MobilityDB master bc6f2729ea and MEOS-API master 71c23da, main's generator answers each <type>SeqSetGaps on the typed Spark and Flink surfaces with the call stating the interval and the distance and the call stating the instants alone, and with no call stating the instants and the interval, and registers neither raster nor raquet: the shorter signature takes the order of the full one, which states arguments it does not, so it pairs nothing and is dropped.

Measured over the same pair with the jar built from that catalog and that libmeos: the Spark SQL and Flink SQL surfaces each answer 1302 SQL functions and 9361 overloads where main's answer 1300 and 9349, the 12 more the call of <type>SeqSetGaps stating the instants and the interval for its 10 temporal types, raster without its nodata value and raquet without its nodata value, and every other generated file is identical. codegen/src/test/java/JvmShorterCallOrderTest.java runs the generator over a function whose SQL arguments come in another order than its C parameters: on main the call leaving its last argument out is missing on both surfaces, and here it passes its arguments to the parameters they stand for and the default to the one it leaves out.
@estebanzimanyi
estebanzimanyi merged commit 3a64a16 into MobilityDB:main Oct 25, 2026
2 checks passed
@estebanzimanyi
estebanzimanyi deleted the codegen/shorter-call-takes-the-function-order branch October 25, 2026 18:43
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