Skip to content

State on each SQL signature that it returns a set - #149

Merged
estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:catalog/setof-signatures
Sep 30, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:catalog/setof-signatures

Conversation

@estebanzimanyi

@estebanzimanyi estebanzimanyi commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

A signature declared RETURNS SETOF carries retSet, PostgreSQL's proretset,
beside ret, the type of one of its rows: unnest(intset) is
{args: [intset], ret: integer, retSet: true, sqlName: unnest}, while
getValues(intset), over the same intset_values, returns one integer[] and
carries no retSet. The RETURNS match of _create_fn_stmts captures SETOF
instead of dropping it, the signatures of one function are told apart by it,
and a bound literal is matched to its signature with it.

Why. Flink and Spark carry a set-returning signature as one function
returning an array that the query unfolds into rows, and a signature
returning one value as a scalar function. The row type alone does not tell
the two apart, and the C shape does not either: an array return backs
getValues as much as unnest.

Measured. Over MobilityDB a362004728, 136 SQL signatures carried by 80
functions state retSet: unnest, the splits, the tiles, the …Pairs kernels,
frechetDistancePath, dynTimeWarpPath and dumpAsPolygons. The catalog is
otherwise identical to the one derived without the change.

Witness. tests/test_sqlfn_setof.py reads SETOF in either case, keeps it
apart from the row type, and states it on the unnest signature of
intset_values and not on its getValues signature.

A signature declared RETURNS SETOF carries retSet, PostgreSQL's proretset,
beside ret, the type of one of its rows: unnest(intset) is
{args: [intset], ret: integer, retSet: true, sqlName: unnest}, while
getValues(intset), over the same intset_values, returns one integer[] and
carries no retSet. The RETURNS match of _create_fn_stmts captures SETOF
instead of dropping it, the signatures of one function are told apart by it,
and a bound literal is matched to its signature with it.

Why. Flink and Spark carry a set-returning signature as one function
returning an array that the query unfolds into rows, and a signature
returning one value as a scalar function. The row type alone does not tell
the two apart, and the C shape does not either: an array return backs
getValues as much as unnest.

Measured. Over MobilityDB a362004728, 136 SQL signatures carried by 80
functions state retSet: unnest, the splits, the tiles, the …Pairs kernels,
frechetDistancePath, dynTimeWarpPath and dumpAsPolygons. The catalog is
otherwise identical to the one derived without the change.

Witness. tests/test_sqlfn_setof.py reads SETOF in either case, keeps it
apart from the row type, and states it on the unnest signature of
intset_values and not on its getValues signature.
@estebanzimanyi
estebanzimanyi force-pushed the catalog/setof-signatures branch from bcb9a15 to 2ff6988 Compare September 30, 2026 12:58
@estebanzimanyi
estebanzimanyi merged commit c663adc into MobilityDB:master Sep 30, 2026
3 checks passed
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