Skip to content

feat(cql2-json): support CQL2 spec function format in parser and encoder#157

Open
constantinius wants to merge 1 commit into
mainfrom
cql2-functions-compliance
Open

feat(cql2-json): support CQL2 spec function format in parser and encoder#157
constantinius wants to merge 1 commit into
mainfrom
cql2-functions-compliance

Conversation

@constantinius

Copy link
Copy Markdown
Contributor

Align the CQL2 Functions conformance class with the OGC 21-065r2 spec.

Changes

  • JSON parser: Unknown op values 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.
  • JSON encoder: Functions now emit {"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: functionRef requires op and args, where op is not a reserved operator name.

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
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