Skip to content

Generate the scalar-valued array accessors#34

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:feat/generate-scalar-value-arrays
Jul 9, 2026
Merged

Generate the scalar-valued array accessors#34
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:feat/generate-scalar-value-arrays

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

Add a generator template for array-returning accessors of the form (inputs…, int *count) -> <scalar>*, where the trailing int * is the element-count out-param and the return is a contiguous fixed-width scalar array. These carry an int * out-param, so the 1:1 and @sqlfn passes exclude them (arg:int *). The template marshals the inputs, allocates the count buffer, and reads the returned array into a Spark array<int|long|double>, freeing it the same way the NxN array kernels do.

Reaches 10 accessors under their C names; the 1:1 generated surface grows by 10 (to 2798):

  • tint_values / tfloat_values / tbigint_values
  • intset_values / floatset_values / bigintset_values
  • th3index_values, tquadbin_values, pose_orientation, quadbin_k_ring

Struct-element arrays (Span* / STBox* / TBox*) stay excluded — their per-element stride is opaque to the binding — as do TimestampTz* elements, which need MEOS-owned rendering rather than a raw long.

A GeneratedSurfaceTest case covers the surface end-to-end against libmeos: tint_values of [1, 2, 1] is the distinct set {1, 2} (size 2, contains 1 and 2), and tfloat_values returns the two distinct doubles — verifying the count out-param, the fixed-stride read, and the array marshalling for both int and double elements.

Add a generator template for array-returning accessors of the form
(inputs..., int *count) -> <scalar>*, where the trailing int* is the element
count out-param and the return is a contiguous fixed-width scalar array. These
carry an int* out-param, so the 1:1 and @sqlfn passes exclude them; the template
marshals the inputs, allocates the count, and reads the returned array into a
Spark array<int|long|double>, freeing it like the NxN array kernels.

Reaches 10 accessors under their C names: tint_values / tfloat_values /
tbigint_values, intset_values / floatset_values / bigintset_values,
th3index_values, tquadbin_values, pose_orientation, quadbin_k_ring.

Struct-element arrays (Span* / STBox* / TBox*) stay excluded — their per-element
stride is opaque to the binding — as do TimestampTz* elements, which need
MEOS-owned rendering rather than a raw long.

Cover the surface with a GeneratedSurfaceTest case on tint_values (distinct set
{1, 2}) and tfloat_values.
@estebanzimanyi
estebanzimanyi merged commit 6c28108 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