Skip to content

Fold out-parameters via the catalog's shape.outParams flag#32

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:feat/outparam-fold-by-flag
Jul 9, 2026
Merged

Fold out-parameters via the catalog's shape.outParams flag#32
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:feat/outparam-fold-by-flag

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

The MEOS-API catalog now carries each function's Doxygen @param[out] tags as shape.outParams, cross-checked against the C signature (MobilityDB/MEOS-API#37). This wires JMEOS to fold out-parameters from that flag instead of a hardcoded parameter-name whitelist ({"size_out"}, {"result"}), which silently missed every out-param spelled otherwise (e.g. int *value, text **value).

What changes

  • FunctionsGenerator reads shape.outParams onto each ParamDef and folds by it. An out-param's role is read from its C type, not its spelling:
    • a size_t* out-param is the throwaway byte-count of the *_as_wkb/*_as_hexwkb family — allocated, forwarded, discarded;
    • any other pointer out-param on a boolean-returning method is the value the wrapper allocates, forwards, reads back, and returns.
  • A boolean function with exactly one such out-param folds to a returned Pointer. Functions with two or more result-out params (intersection_*/synchronize_*: inter1/inter2; *_to_arrow: out_schema/out_array) cannot collapse to a single returned buffer, so they keep those out-params as caller-provided Pointer arguments.
  • The vendored catalog gains shape.outParams (380 functions, 438 out-params).
  • The one hand-written consumer that passed a now-folded buffer (TText.value_at_timestamp) is adapted to the folded 3-arg signature.

Effect

value_at_timestamptz/_n and the box tmax/tmin accessors now fold uniformly:

tint_value_at_timestamptz(Pointer, OffsetDateTime, boolean) -> Pointer   // was 4-arg, exposed the raw out-param
temporal_as_hexwkb(Pointer, byte) -> String                              // size_out folded
intersection_temporal_temporal(Pointer, Pointer, int, Pointer, Pointer)  // two out-params: unchanged

Verified: generator + jmeos-core compile clean, the jar packages, and javap confirms the folded and preserved signatures above.

The MEOS-API catalog carries each function's Doxygen @param[out] tags as
shape.outParams, cross-checked against the C signature. Read that flag on
each ParamDef and fold out-parameters from it instead of a hardcoded
parameter-name whitelist, so an out-param folds regardless of how it is
spelled in the signature (size_out, size, result, value, ...).

A size_t* out-param is the throwaway byte-count of the *_as_wkb/_as_hexwkb
family; any other pointer out-param on a boolean-returning method is the
value the wrapper allocates, forwards, reads back, and returns. A boolean
function with exactly one such out-param folds to a returned Pointer;
functions with two or more (intersection_*/synchronize_*: inter1/inter2,
*_to_arrow: out_schema/out_array) keep those out-params as caller-provided
Pointer arguments.

Enrich the vendored catalog with shape.outParams and adapt the one
hand-written consumer (TText.value_at_timestamp) to the folded signature.
@estebanzimanyi estebanzimanyi force-pushed the feat/outparam-fold-by-flag branch from 706445b to d9c99ca Compare July 9, 2026 20:24
@estebanzimanyi estebanzimanyi merged commit 3e56974 into MobilityDB:main Jul 9, 2026
1 check 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