Generate the scalar-valued array accessors#34
Merged
estebanzimanyi merged 1 commit intoJul 9, 2026
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a generator template for array-returning accessors of the form
(inputs…, int *count) -> <scalar>*, where the trailingint *is the element-count out-param and the return is a contiguous fixed-width scalar array. These carry anint *out-param, so the 1:1 and@sqlfnpasses exclude them (arg:int *). The template marshals the inputs, allocates the count buffer, and reads the returned array into a Sparkarray<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_valuesintset_values/floatset_values/bigintset_valuesth3index_values,tquadbin_values,pose_orientation,quadbin_k_ringStruct-element arrays (
Span*/STBox*/TBox*) stay excluded — their per-element stride is opaque to the binding — as doTimestampTz*elements, which need MEOS-owned rendering rather than a raw long.A
GeneratedSurfaceTestcase covers the surface end-to-end against libmeos:tint_valuesof[1, 2, 1]is the distinct set{1, 2}(size 2, contains 1 and 2), andtfloat_valuesreturns the two distinct doubles — verifying the count out-param, the fixed-stride read, and the array marshalling for both int and double elements.