Generate function shape (output arrays + nullability) from the headers#16
Open
estebanzimanyi wants to merge 1 commit into
Open
Generate function shape (output arrays + nullability) from the headers#16estebanzimanyi wants to merge 1 commit into
estebanzimanyi wants to merge 1 commit into
Conversation
The binding codegens consume each function's `shape` (array-return length, written-back output arrays, parameter nullability) from the IDL. Generate it from the headers instead of the hand-maintained meta stub, which had drifted to three functions and emitted no shape for the other 2900+ -- leaving every codegen to mis-handle the split/space-split/mvtgeom out-arrays and the nullable srs/maxt/state parameters. - parser/shapeinfer.py: infer arrayReturn/outputArrays from the parameter forms. A non-const `TYPE **` paired with a by-pointer `int *count` is a written-back out-array; a by-value `int count` marks a read-only in-array. - parser/nullable.py: read parameter nullability from the C Doxygen `@param ... may be NULL` source of truth and fold it into shape.nullable for the params present on each function. - run.py: wire both into the IDL build. Adds unit tests for both modules.
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.
Problem
The binding codegens (PyMEOS-CFFI, GoMEOS, JMEOS, …) read each function's
shapefrom the IDL to decide which parameters are written-back output arrays and which accept NULL. That shape used to come from a hand-maintainedmeta/meos-meta.json, which has drifted to a 3-function stub that emits no shape for the other 2900+ functions. Downstream, this silently mis-handles:*_value_split/*_space_split/tpoint_as_mvtgeom/nsegmentarr_normalizefamilies — their out-arrays get generated as input parameterssrs/maxt/ aggregatestate— generated as non-nullable, so aNoneraises instead of converting toNULLFix — generate the shape from the headers (no hand table)
parser/shapeinfer.py— inferarrayReturn.lengthFrom+outputArraysfrom the parameter forms. The discriminator is the count parameter: a non-constTYPE **paired with a by-pointerint *countis a written-back out-array; a by-valueint countmarks a read-only in-array (e.g. the*_makeconstructors).parser/nullable.py— read parameter nullability from the C Doxygen@param … may be NULLsource of truth (see MobilityDB#1121, which completes those annotations) and fold it intoshape.nullablefor the params present on each function.run.py— wire both into the IDL build.Independent of #15 (type recovery); both extend the same IDL-correctness pipeline and can land in either order. Adds unit tests for both modules (full suite green: 30 passed).