Skip to content

Take a public function's input arrays as Python lists - #33

Merged
estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:feat/input-arrays-as-lists
Oct 22, 2026
Merged

estebanzimanyi merged 1 commit into
MobilityDB:masterfrom
estebanzimanyi:feat/input-arrays-as-lists

Conversation

@estebanzimanyi

@estebanzimanyi estebanzimanyi commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

The catalog's shape.inputArrays names each array a function reads and the parameter its length comes from. A public function takes each such array as one Python list (bytes for uint8_t): the length is not an argument, it is the list's own, and arrays sharing one length must agree in length.

  • Elements convert as a scalar argument of their type does, a pointer element is cast, and a struct element is the struct itself (PyMEOS passes span._inner[0]).
  • One rule covers every public array reader: the set and span set constructors, tsequenceset_make_gaps, the *_from_wkb functions and tpointseq_make_coords among them. Their hand modifiers are removed.
  • Internal functions keep the pointer and the count: tsequence_make_free and its siblings free the array they are given, which must be MEOS's own.
  • An arrayReturn length is an output only when MEOS writes it through a pointer; temparr_round, stboxarr_round, cbufferarr_round and posearr_round take it by value and read it from the list.

The surface is generated from the catalog of MobilityDB master ff56f3f93f, the MEOS 1.4 line.

Witness: against libmeos built from that commit, builder/smoke_test.py passes, and a call per element kind (TInstant *, TSequence *, Temporal *, Span, STBox, text *, TimestampTz, DateADT, double, int, int64, GSERIALIZED *, uint8_t) returns the expected value; parallel arrays of different lengths raise ValueError.

@estebanzimanyi
estebanzimanyi force-pushed the feat/input-arrays-as-lists branch from 54f48ae to 0cf1dae Compare October 22, 2026 17:46
shape.inputArrays names each array a function reads and the parameter its
length comes from. A public function takes each such array as one list
(bytes for uint8_t), its length leaves the signature and is the list's own,
and arrays sharing one length must agree. Elements convert as a scalar
argument of their type does, a pointer element is cast, and a struct element
is the struct itself. This replaces the hand modifiers of the set and span
set constructors, tsequenceset_make_gaps and the from_wkb functions, and
covers the other public array readers, tpointseq_make_coords among them.

Internal functions keep the pointer and the count: tsequence_make_free and
its siblings free the array they are given, which must be MEOS's own.

An arrayReturn length is an output only when MEOS writes it through a
pointer. temparr_round, stboxarr_round, cbufferarr_round and posearr_round
take it by value as the length of the input array the return matches, and
read it from that list.
@estebanzimanyi
estebanzimanyi force-pushed the feat/input-arrays-as-lists branch from 0cf1dae to c699196 Compare October 22, 2026 19:15
@estebanzimanyi
estebanzimanyi merged commit 7d87c08 into MobilityDB:master Oct 22, 2026
4 checks passed
@estebanzimanyi
estebanzimanyi deleted the feat/input-arrays-as-lists branch October 22, 2026 19:52
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