Skip to content

feat(codegen): IDL-driven NES MEOS-operator generator with idempotent build/grammar/QPC glue#170

Open
estebanzimanyi wants to merge 4 commits into
MobilityDB:mainfrom
estebanzimanyi:feat/nebula-codegen-generator-infra
Open

feat(codegen): IDL-driven NES MEOS-operator generator with idempotent build/grammar/QPC glue#170
estebanzimanyi wants to merge 4 commits into
MobilityDB:mainfrom
estebanzimanyi:feat/nebula-codegen-generator-infra

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

tools/codegen/ contains codegen_nebula.py, which reads a JSON operator descriptor and emits the four-layer NebulaStream pipeline tuple (logical .hpp/.cpp + physical .hpp/.cpp) per MEOS scalar function, then idempotently injects add_plugin entries into the Meos CMakeLists files, lexer tokens and functionName alternations into AntlrSQL.g4, and dispatch cases into AntlrSQLQueryPlanCreator.cpp — each injection gated by a per-op marker so repeated runs are safe. build_descriptor.py classifies MEOS gap functions by signature into named SHAPEs that select the corresponding physical C++ template; trgeo-descriptor.json is the ready-to-use descriptor for the 34-operator trgeometry family (W148–W149). codegen_aggregations.py handles the separate aggregation four-layer shape. codegen_input.example.json documents the descriptor format. build_local.sh drives the NebulaStream dev-image cmake build without a host C++23 toolchain. The generator reproduces the committed W148–W149 trgeometry surface byte-for-byte from the descriptor. The generated IDL (meos-idl.json) is excluded from the repository and regenerated via MEOS-API run.py against the pinned MEOS headers.

@estebanzimanyi estebanzimanyi force-pushed the feat/nebula-codegen-generator-infra branch from 3c59e5c to 93d02d0 Compare June 24, 2026 22:28
…aho-mqtt-cpp

The Nix environment provides paho-mqtt-cpp as a shared-only library and does
not include libmeos.  Four changes make the build pass:

- flake.nix: add stock paho-mqtt-c + paho-mqtt-cpp to baseThirdPartyDeps;
  pass -DNES_ENABLE_MEOS=OFF in both defaultPackage and devShell cmakeFlags.

- nes-plugins/CMakeLists.txt: introduce NES_ENABLE_MQTT and NES_ENABLE_MEOS
  options that gate the respective plugin subdirectories via
  activate_optional_plugin().

- nes-plugins/Sources/MQTTSource, nes-plugins/Sinks/MQTTSink: select
  PahoMqttCpp::paho-mqttpp3-static when available, fall back to the shared
  PahoMqttCpp::paho-mqttpp3 target (Nix only ships the shared variant).

- nes-physical-operators: gate all MEOS-specific add_plugin calls and the
  nes-meos link behind if(NES_ENABLE_MEOS) in three CMakeLists files
  (top-level, Functions/Meos, Aggregation/Function/Meos).

- CMakeLists.txt (root): declare option(NES_ENABLE_MEOS) and
  add_compile_definitions(NES_ENABLE_MEOS) before the nes-* subdirectory
  loop so the preprocessor symbol is visible to all sibling components.

- nes-query-optimizer/LowerToPhysicalWindowedAggregation.cpp: guard the
  TemporalSequenceAggregationPhysicalFunction include and instantiation
  with #ifdef NES_ENABLE_MEOS so the translation unit compiles and links
  when MEOS is disabled.
… build/grammar/QPC glue

tools/codegen/ contains codegen_nebula.py, which reads a JSON operator descriptor and emits the four-layer NebulaStream pipeline tuple (logical .hpp/.cpp + physical .hpp/.cpp) per MEOS scalar function, then idempotently injects add_plugin entries into the Meos CMakeLists files, lexer tokens and functionName alternations into AntlrSQL.g4, and dispatch cases into AntlrSQLQueryPlanCreator.cpp — each injection gated by a per-op marker so repeated runs are safe. build_descriptor.py classifies MEOS gap functions by signature into named SHAPEs that select the corresponding physical C++ template; trgeo-descriptor.json is the ready-to-use descriptor for the 34-operator trgeometry family (W148–W149). codegen_aggregations.py handles the separate aggregation four-layer shape. codegen_input.example.json documents the descriptor format. build_local.sh drives the NebulaStream dev-image cmake build without a host C++23 toolchain. The generator reproduces the committed W148–W149 trgeometry surface byte-for-byte from the descriptor. The generated IDL (meos-idl.json) is excluded from the repository and regenerated via MEOS-API run.py against the pinned MEOS headers.
@estebanzimanyi estebanzimanyi force-pushed the feat/nebula-codegen-generator-infra branch from 93d02d0 to ae1067f Compare June 24, 2026 23:02
estebanzimanyi added a commit to estebanzimanyi/MobilityNebula that referenced this pull request Jun 25, 2026
Add tools/pin/compose-order.txt (the canonical fold manifest of the ~50 open
codegen-wave PRs from the live DAG: generator infra MobilityDB#170 first, then the
per-family NES operator waves W105-W149, then the -22a verify/regenerate PRs)
and GENERATION.md (the per-binding generator policy: MobilityNebula generates
the NES MEOS-operator surface via tools/codegen/codegen_nebula.py from the
catalog, family-organized, zero hand special-cases).
@estebanzimanyi

Copy link
Copy Markdown
Member Author

Superseded. The per-event MEOS operator surface is delivered as a generator-derived one-change PR stack: the Nix build fix (#171), the operator generator (tools/codegen), and the canonical 615-op generated surface (verified generator==committed, Nix Build green). This evidence/verification PR is folded into that deliverable.

@estebanzimanyi estebanzimanyi reopened this Jul 2, 2026
estebanzimanyi added a commit to estebanzimanyi/MobilityNebula that referenced this pull request Jul 6, 2026
Add tools/pin/compose-order.txt (the canonical fold manifest of the ~50 open
codegen-wave PRs from the live DAG: generator infra MobilityDB#170 first, then the
per-family NES operator waves W105-W149, then the -22a verify/regenerate PRs)
and GENERATION.md (the per-binding generator policy: MobilityNebula generates
the NES MEOS-operator surface via tools/codegen/codegen_nebula.py from the
catalog, family-organized, zero hand special-cases).
…LIZED*

MEOS-API run.py correctly resolves GSERIALIZED in the IDL; parse_sigs
normalizes `const GSERIALIZED *` to GSERIALIZED* (strip-const + first-token
+ "*"). The four trgeometry shape classifiers that match geometry arguments
use GSERIALIZED* throughout:

- trgeometry_geo_predicate:  (Temporal*, int*)        → (Temporal*, GSERIALIZED*)
- geo_trgeometry_predicate:  (int*, Temporal*)         → (GSERIALIZED*, Temporal*)
- trgeometry_geo_dwithin:    (Temporal*, int*, double) → (Temporal*, GSERIALIZED*, double)
- trgeometry_nad geo-branch: (Temporal*, int*)         → (Temporal*, GSERIALIZED*)

The trgeometry_nad two-temporal branch adds fn.endswith("_trgeometry") so
nad_trgeometry_tpoint (Temporal*, Temporal*) is excluded, matching the
committed descriptor's scope.

Equivalence probe: build_descriptor.py against the master IDL (4492 fns)
reproduces the committed trgeo-descriptor.json 34-operator set byte-for-byte.
Genuine int* out-params (trgeometry_instants/segments/sequences/stboxes, all
with non-int return types) are unaffected. nad_trgeometry_tpoint is correctly
excluded.
…lways verbs

cmp_scalar_tempfirst and cmp_scalar_scalarfirst matched on signature alone, so a nearest-approach
function like nad_tint_int (int(Temporal*, int)) was misclassified as a comparison operator. Require
the ever/always + {eq,ne,lt,le,gt,ge} naming so only comparison functions match.
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