Skip to content

State an array return as long as an array the function reads - #186

Merged
estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:catalog/arr-round-array-return
Oct 10, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:catalog/arr-round-array-return

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

A function returning the element of an input array with one more pointer level returns an array
of that input array's length: temparr_round(Temporal **temp, int count, int maxdd) returns
count values as Temporal **, cbufferarr_round and posearr_round count Cbuffer ** and Pose ** the
same way, and stboxarr_round(const STBox *boxarr, int count, int maxdd) returns count boxes as
STBox *. attach_counted_array_returns of parser/shapeinfer.py states shape.arrayReturn for such a
function, with the lengthFrom of that input array and the element read from the return as
infer_shapes reads it, when the function has no int *count out-parameter and exactly one length
among the input arrays of that element; it runs after attach_struct_input_arrays, which states
the boxarr of stboxarr_round. A return of the element type itself is one value and states no
array: temporal_merge_array(Temporal **temparr, int count) returns one Temporal *, and
geo_cluster_intersecting keeps the length of its int *count.

The wire follows the shape. _counted_array_return of parser/enrich.py serves such a return as a
result of kind array whose count_param names the length of the request's array, and the server
reads back that many element pointers through invoke_counted_array of server/engine.py. A return
counted by an argument the request carries as one value is refused naming it: stboxarr_round
reads boxarr as one serialized box, so it is array-or-out-param:boxarr rather than a single
STBox * encoded with stbox_out.

Witness: on MEOS-API master d259ddb over MobilityDB master bdc4e41234 the catalog states no
arrayReturn for the four, refuses temparr_round, cbufferarr_round and posearr_round as
unsupported-return, and maps stboxarr_round to one STBox * result, so a binding returns its first
box only.

Measured over MobilityDB master bdc4e41234 with an all-families libmeos: run.py states 4 such
array returns, those of temparr_round, cbufferarr_round, posearr_round and stboxarr_round, and
every other key of every function equals that of master's parser; the exposable count moves from
3378 to 3380. They are the only public functions whose documentation returns an array the catalog
states no arrayReturn for. The suite passes 534 tests with none skipped, among them the five of
tests/test_shapeinfer.py CountedArrayReturnTests and the round trip of temparr_round against
libmeos in tests/test_engine_integration.py; the floor of .github/workflows/pytest.yml reads 534.

Why: the length of an array a function returns is the catalog's to state, and a binding that reads
it from the catalog returns every element.

A function returning the element of an input array with one more pointer level returns an array
of that input array's length: temparr_round(Temporal **temp, int count, int maxdd) returns
count values as Temporal **, cbufferarr_round and posearr_round count Cbuffer ** and Pose ** the
same way, and stboxarr_round(const STBox *boxarr, int count, int maxdd) returns count boxes as
STBox *. attach_counted_array_returns of parser/shapeinfer.py states shape.arrayReturn for such a
function, with the lengthFrom of that input array and the element read from the return as
infer_shapes reads it, when the function has no int *count out-parameter and exactly one length
among the input arrays of that element; it runs after attach_struct_input_arrays, which states
the boxarr of stboxarr_round. A return of the element type itself is one value and states no
array: temporal_merge_array(Temporal **temparr, int count) returns one Temporal *, and
geo_cluster_intersecting keeps the length of its int *count.

The wire follows the shape. _counted_array_return of parser/enrich.py serves such a return as a
result of kind array whose count_param names the length of the request's array, and the server
reads back that many element pointers through invoke_counted_array of server/engine.py. A return
counted by an argument the request carries as one value is refused naming it: stboxarr_round
reads boxarr as one serialized box, so it is array-or-out-param:boxarr rather than a single
STBox * encoded with stbox_out.

Witness: on MEOS-API master d259ddb over MobilityDB master bdc4e41234 the catalog states no
arrayReturn for the four, refuses temparr_round, cbufferarr_round and posearr_round as
unsupported-return, and maps stboxarr_round to one STBox * result, so a binding returns its first
box only.

Measured over MobilityDB master bdc4e41234 with an all-families libmeos: run.py states 4 such
array returns, those of temparr_round, cbufferarr_round, posearr_round and stboxarr_round, and
every other key of every function equals that of master's parser; the exposable count moves from
3378 to 3380. They are the only public functions whose documentation returns an array the catalog
states no arrayReturn for. The suite passes 534 tests with none skipped, among them the five of
tests/test_shapeinfer.py CountedArrayReturnTests and the round trip of temparr_round against
libmeos in tests/test_engine_integration.py; the floor of .github/workflows/pytest.yml reads 534.

Why: the length of an array a function returns is the catalog's to state, and a binding that reads
it from the catalog returns every element.
@estebanzimanyi
estebanzimanyi force-pushed the catalog/arr-round-array-return branch from 690752c to 7b707af Compare October 10, 2026 07:25
@estebanzimanyi
estebanzimanyi merged commit ff5f838 into MobilityDB:master Oct 10, 2026
3 checks passed
@estebanzimanyi
estebanzimanyi deleted the catalog/arr-round-array-return branch October 10, 2026 07:31
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