feat(cql2-json): support CQL2 spec function format in parser and encoder#157
Open
constantinius wants to merge 1 commit into
Open
feat(cql2-json): support CQL2 spec function format in parser and encoder#157constantinius wants to merge 1 commit into
constantinius wants to merge 1 commit into
Conversation
Add support for the standard CQL2-JSON function call format where functions
are expressed as {"op": "func_name", "args": [...]} at the top level,
in addition to the existing {"function": {"name": ..., "arguments": [...]}}
backward-compatible format.
Changes:
- parser.py: add else branch after BINARY_OP_PREDICATES_MAP check to treat
unknown ops as Function nodes instead of raising ValueError
- evaluate.py: simplify Function handler to always emit {"op": name, "args": [...]}
(spec-compliant format), removing non-standard lower/upper/function variants
- test_parser.py: add three new tests covering spec-format parsing, old-format
backward compatibility, and spec-format encoding
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.
Align the CQL2 Functions conformance class with the OGC 21-065r2 spec.
Changes
opvalues are now treated as function calls (ast.Function), supporting the spec's{"op": "funcName", "args": [...]}format. The old{"function": {"name": "...", "arguments": [...]}}format is preserved for backward compatibility.{"op": name, "args": [...]}per spec, replacing the non-standard{"function": name, "args": [...]}and{"lower": ...}/{"upper": ...}formats.Spec reference
OGC 21-065r2 §6.11
JSON schema:
functionRefrequiresopandargs, whereopis not a reserved operator name.