Skip to content

Extend the meos-idl codegen to all installed-public families on the -22a catalog#5

Open
estebanzimanyi wants to merge 13 commits into
MobilityDB:mainfrom
estebanzimanyi:codegen/flat-wrappers-22a
Open

Extend the meos-idl codegen to all installed-public families on the -22a catalog#5
estebanzimanyi wants to merge 13 commits into
MobilityDB:mainfrom
estebanzimanyi:codegen/flat-wrappers-22a

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

Extends the IDL-driven GoMEOS codegen (tools/codegen.py) to cover every installed-public MEOS family, and refreshes the vendored catalog to the consolidated ecosystem-pin-2026-06-22a surface (4463 functions).

Generator coverage

  • HEADER_FILES + the cgo preamble now include meos_h3.h, meos_quadbin.h, meos_json.h, meos_pointcloud.h, meos_arrow.h (mirroring the existing meos_cbuffer/pose/rgeo.h entries).
  • TYPE_MAP: the canonical enum spellings MeosType / MeosOper, the int64_t / uint64_t scalar spellings, Quadbin (typedef uint64), and the RTreeSearchOp / nullHandleType enums.
  • WRAPPER_TYPES: Jsonb, JsonPath, Pcpoint, Pcpatch, TPCBox, MeosArray, PCSCHEMA.

Result

  • Generated wrappers in tools/_preview/ grow from 2441 to 3088.
  • Unresolved-shape // TODO stubs drop from 601 to 75 (the remainder are array / out-parameter / Arrow-pointer shapes, left for a follow-up).
  • go test ./tools/parity/ passes; the shipped gomeos package is untouched.

The generated surface is the IDL-driven Draft consumed by the parity gate. Promoting it to the shipped package (and retiring the hand-written cgo) is a separate change.

Stacked on #4.

estebanzimanyi and others added 13 commits May 13, 2026 11:37
Adopts the unified spatial nomenclature (tpoint_* renamed to tspatial_*
/ tgeo_* depending on signature), the meos_initialize() split that
moves the timezone to a separate call, and the temporal_append_tinstant
interpType parameter.  cast.h gains stddef.h so size_t resolves on
hosts that do not transitively include it via meos.h.
tools/codegen.py reads tools/meos-idl.json produced by the MEOS-API
parser and emits idiomatic Go wrappers into tools/_preview/, prefixed
with an underscore so the existing hand-written surface is unaffected
(go build ./... ignores _-prefixed directories).  The first cut covers
1967 of the 2369 candidate functions across the six public headers:
scalar inputs, opaque-pointer wrappers (Temporal, STBox, TBox, Span,
SpanSet, Set, GSERIALIZED, TInstant, TSequence, TSequenceSet, Npoint,
Nsegment, SkipList, RTree, Interval), C and PostgreSQL text strings.
170 Datum-bearing helpers are skipped as MEOS-internal (the hand-written
surface exposes them through typed overloads that the codegen cannot
synthesise from the IDL).  232 functions remain as TODO until a per-
function metadata catalog mirrors the result / output / nullable sets
that PyMEOS-CFFI keeps in build_pymeos_functions.py.
Extends the codegen with name-driven classification so the bulk of the
remaining unsupported shapes emit cleanly: output parameters named
result / value lower to extra Go return values for scalar, wrapped
opaque, and text **; counted-array inputs (T ** / const T * / text **
paired with int count or size_t size) lower to Go slices; counted-array
returns (T ** paired with int *count or matching the length of an
input slice) and uint8_t * byte buffers lower to Go slices via
unsafe.Slice plus per-element conversion.  char ** array returns,
unsafe.Pointer for void * arguments, and additional opaque wrappers
(Match, BOX3D, GBOX, AFFINE, PJ_CONTEXT, gsl_rng, TimeADT) round out
the surface.  Coverage rises from 1967 to 2167 idiomatic wrappers; the
remaining 32 TODOs need a per-function metadata catalog (sibling-
accessor lookups for length, parallel output arrays sharing a count,
triple-pointer outputs, function-pointer hooks) that mirrors the
output_parameters / result_parameters sets PyMEOS-CFFI carries.
Consumes the shape metadata MEOS-API now ships in meos-idl.json so the
codegen no longer needs to second-guess every signature.  arrayReturn
with kind=accessor calls the named sibling on a wrapper input to
recover the slice length (set_num_values, spanset_num_spans, with an
optional castTo for the Temporal upcast used by tsequence_insts_p and
friends).  outputArrays declares parallel out-parameters and the body
pass unpacks each as a Go slice sharing the primary length, covering
the *_split family, the GSERIALIZED *** triple-pointer outputs of
tgeo_space_split / tgeo_space_time_split, and tpoint_as_mvtgeom.
arrayInputGroup folds the four parallel coordinate arrays of
tpointseq_make_coords into Go slices with nullable handling for the
optional ones.  namedOutputs surfaces tempsubtype_from_string's subtype
and geom_min_bounding_radius's radius as second Go return values.
shape.skip excludes the skiplist function-pointer helpers.  Coverage
goes from 2167 emitted / 32 TODO to 2194 emitted / 0 TODO / 5
explicit-skip; uint32_t is now in the type map and text ** array
returns lower to []string via text2cstring per element.
Aggregation depends on the skiplist API and the other bindings that
consume meos-idl.json all expose its function-pointer and void **
arguments as raw pointers (PyMEOS-CFFI as _ffi.CData, MEOS.NET as
IntPtr).  GoMEOS now does the same: void **, const void **,
datum_func2, error_handler_fn, and the two anonymous function-pointer
typedefs (int (*)(void *, void *) and void *(*)(void *, void *)) map
to unsafe.Pointer; SkipListType joins the enum group.  The classifier
no longer treats a count following void ** as ARRAY_LENGTH, so the
count parameter of skiplist_splice / temporal_skiplist_splice stays a
real Go input instead of being derived from a non-existent slice
length.  The five shape.skip entries the previous commit added are
removed from meta/meos-meta.json; coverage rises to 2199 emitted /
0 TODO / 0 explicit-skip across 2369 candidates.
The metadata extension on MEOS-API MobilityDB#2 added shape.nullable across 38
functions and shape.outputArrays on tpoint_as_mvtgeom / *_hexwkb /
*_time_tiles.  Re-vendoring keeps GoMEOS in sync with the ecosystem
catalog; the generated wrappers in tools/_preview/ are byte-identical
because the GoMEOS codegen does not yet consume shape.nullable
(nullability in Go is expressed via type rather than at the call site).
Vendor the MEOS 1.4 IDL (3544 functions, +1149 over 1.3) and the three
new public headers (meos_cbuffer.h, meos_pose.h, meos_rgeo.h) to
HEADER_FILES. Regenerate the tools/_preview/ wrappers against the new
catalog.

Update the hand-written wrappers in main_tpoint.go to match the MEOS
1.4 signatures: the tspatial-rel family (tcontains/tdisjoint/tdwithin/
tintersects/ttouches) dropped the restr/atvalue parameters and
tpoint_at_geom/tpoint_minus_geom dropped the trailing z-span filter.
The previous IDL was parsed from the MobilityDB source tree which
duplicates GSERIALIZED across build/postgis headers. Libclang
canonicalised the type to int * for ~400 geometry-bearing functions.
Regenerated against /usr/local/include and the codegen now emits
proper GSERIALIZED * wrappers.

TODO counts on the public surface dropped:
  meos_geo.h:          200 -> 0
  meos.h:              157 -> 10
  meos_internal.h:      22 -> 13
  meos_internal_geo.h:  12 -> 0
  meos_npoint.h:        15 -> 0

The remaining cbuffer/pose TODOs need shape metadata in MEOS-API for
the *_in/_out/_round families before they can be wrapped without
human intervention.
The MEOS 1.4 surface adds the cbuffer, pose, and rgeo temporal type
families.  Add them to WRAPPER_TYPES so the generator emits proper
*Cbuffer / *Pose / *Rgeo wrappers instead of leaving 277 TODO stubs.

TODO counts on the new headers drop to:
  meos_cbuffer.h: 105 -> 1
  meos_pose.h:     77 -> 2
  meos_rgeo.h:      1 -> 0

The three remaining (cbufferset_values, poseset_values, pose_orientation)
need shape metadata in MEOS-API before they can be wrapped without
hand-rolling the length-from-accessor pattern.
MEOS-API now carries arrayReturn metadata for cbufferset_values and
poseset_values, mirroring geoset_values. cbuffer TODO drops 1 -> 0;
pose TODO drops 2 -> 1 (only pose_orientation remains, which returns a
fixed-size 4-element quaternion that needs its own shape kind).
State that GoMEOS tracks MEOS 1.4 and that the wrappers are generated
from the MEOS-API meos-idl.json catalog, pointing at tools/README.md for
regeneration, and fix the MobilityDB link to the source repository.
Add the canonical portable bare-name dialect (RFC #920) parity gate so
GoMEOS exposes the same operator -> bareName surface as every other
MobilityDB binding/engine, verified by construction across all six
in-scope user-facing type families.

Stacks on the MEOS 1.4 bump (PR MobilityDB#3, bump/meos-1.4): the IDL-driven
codegen there emits tools/_preview/*.go from tools/meos-idl.json (the
MEOS-API parser's JSON output), wrapping every operator's own backing C
function for temporal, geo, cbuffer, npoint, pose and rgeo.

- tools/portable-aliases.json: the 29-pair contract, vendored
  byte-identical from MEOS-API meta/portable-aliases.json (single source
  of truth); --idl prefers the catalog's folded-in copy once present.
- tools/portable_parity.py: audits the exposed CGO symbol set -- every
  C.<symbol>( in the hand-written root *.go AND the IDL-driven
  tools/_preview/*.go. A bare name is backed iff some referenced MEOS
  symbol == bareName or startswith(bareName + "_"), with the contract's
  verified explicitBacking (nearestApproachDistance <- nad_*). Reads
  JSON-derived artifacts only -- never parses meos.h.
- tools/parity/parity_test.go: pure-Go, no import "C" -- a
  language-independent mirror with an identical verdict that runs in CI
  with no libmeos/CGO toolchain.
- .github/workflows/portable-parity.yml: runs both gates on push/PR.
- tools/PORTABLE_ALIASES.md: documents the dialect and the gate.

Result: 29/29 bare names backed, 0 unbacked, all six in-scope families
covered (temporal, geo, cbuffer, npoint, pose, rgeo) -- 100% parity.
The gate hard-fails on any in-scope family that is present in the
surface but unbacked, or absent: cbuffer/npoint/pose/rgeo are full
user-facing types and are never excluded from the parity headline.
The pre-1.4 tdistance version bridge is now inert -- MEOS 1.4 provides
the canonical tdistance_* prefix.
Refresh the vendored catalog to the consolidated ecosystem-pin-2026-06-22a
surface (4463 functions, consolidated type spellings) and extend the generator
so every installed-public family is emitted:

- HEADER_FILES + cgo preamble: add meos_h3/quadbin/json/pointcloud/arrow.h.
- TYPE_MAP: MeosType/MeosOper (canonical enum spellings), int64_t/uint64_t,
  Quadbin (uint64), RTreeSearchOp, nullHandleType.
- WRAPPER_TYPES: Jsonb, JsonPath, Pcpoint, Pcpatch, TPCBox, MeosArray, PCSCHEMA.

Emitted wrappers 2441 -> 3088; TODO shape stubs 260 -> 75 (remaining are
array / out-param / Arrow-pointer shapes).
estebanzimanyi added a commit to estebanzimanyi/GoMEOS that referenced this pull request Jun 25, 2026
main is the old hand-written 1.3-era cgo binding; the codegen-driven 1.4/-22a
surface lives in open PRs. Add tools/pin/compose-order.txt (the canonical fold
manifest with the disposition of every open PR; MobilityDB#5 is the verified frontier
containing MobilityDB#2+MobilityDB#4) and GENERATION.md (the per-binding generator policy: GoMEOS
owns its generator in-repo at tools/codegen.py; flat generated cgo wrappers;
generate-then-retire the hand-written binding).
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