Skip to content

Read an array of scalars at the scalar's own width - #35

Merged
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:fix/scalar-array-element-width
Sep 3, 2026
Merged

Read an array of scalars at the scalar's own width#35
estebanzimanyi merged 1 commit into
MobilityDB:mainfrom
estebanzimanyi:fix/scalar-array-element-width

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

An array MEOS answers is read at eight bytes a step whenever Marshal.Copy
carries no overload for its element — the fallback for an array of POINTERS,
reached by anything else. tbool_values answers a bool *, one byte an
element, so the walk runs off the end of the array and hands back the values'
own bytes as addresses; geo_cluster_dbscan answers a uint32_t * and reads
two cluster ids at a time as one number.

An element the layer knows the width of is read at that width: a bool a byte
at a time and true when non-zero, a uint four, a ulong eight, a float
through its bits. The pointer walk stays what it is for — an array of pointers
to MEOS values — and Marshal.Copy keeps the elements it has an overload for.

The object layer hands on an array of scalars whichever scalar it holds, rather
than the four spellings it named, so TBool.Values answers bool[] and
Geo.ClusterDbscan a uint[]. 1337 methods against 1335, 23 deferred against
25.

Two tests read the values back: a temporal boolean answers the two distinct
booleans it takes, and a temporal float the two doubles — the second the control
that Marshal.Copy is untouched.

An array MEOS answers is read at eight bytes a step whenever `Marshal.Copy`
carries no overload for its element — the fallback for an array of POINTERS,
reached by anything else. `tbool_values` answers a `bool *`, one byte an
element, so the walk runs off the end of the array and hands back the values'
own bytes as addresses; `geo_cluster_dbscan` answers a `uint32_t *` and reads
two cluster ids at a time as one number.

An element the layer knows the width of is read at that width: a `bool` a byte
at a time and true when non-zero, a `uint` four, a `ulong` eight, a `float`
through its bits. The pointer walk stays what it is for — an array of pointers
to MEOS values — and `Marshal.Copy` keeps the elements it has an overload for.

The object layer hands on an array of scalars whichever scalar it holds, rather
than the four spellings it named, so `TBool.Values` answers `bool[]` and
`Geo.ClusterDbscan` a `uint[]`. 1337 methods against 1335, 23 deferred against
25.

Two tests read the values back: a temporal boolean answers the two distinct
booleans it takes, and a temporal float the two doubles — the second the control
that `Marshal.Copy` is untouched.
@estebanzimanyi
estebanzimanyi merged commit bf3fec9 into MobilityDB:main Sep 3, 2026
1 check passed
@estebanzimanyi
estebanzimanyi deleted the fix/scalar-array-element-width branch September 3, 2026 11:09
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