Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions core-spec/expression_language.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ All identifiers MUST be valid names and follow ANSI SQL naming, with the size li

Regular identifiers (unquoted) should be case insensitive. For example, an identifier id is regular, so it would match with Id or iD. Comparing quoted and non-quoted identifiers is DB specific, so for best portability it is best to use simple identifiers.

Function names should also be case insensitive. For example, `SUM`, `sum`, and `Sum` name the same function.

The quote character for the Ossie dialect will follow ANSI SQL and support the double quote character (“). This means that if an expression is in a field expression or as an identifier in the YAML, this will be the expected quoting. However, there are some databases that use other escape characters. Working with these have the option of either creating expressions using their dialect or having the Ossie document written in the Ossie dialect, but then queried in the local dialect.

#### Comparison Table
Expand Down Expand Up @@ -153,6 +155,7 @@ Ossie expressions support the following SQL constructs within any expression:
| `UNION` / `INTERSECT` / `EXCEPT` | Not applicable to expressions |
| DDL statements | Out of scope |
| DML statements | Out of scope |
| `AGG(...)` | Reserved for a future version. See [Measure Evaluation: `AGG`](#measure-evaluation-agg-reserved). |

### Operator Precedence

Expand Down Expand Up @@ -278,6 +281,14 @@ COUNT(DISTINCT customer_id) FILTER (WHERE status = 'completed') --> COUNT(DISTI

A non-matching row contributes `NULL`, which these functions ignore. An `ELSE 0` would count as a real row and would corrupt `AVG`, `MIN`, `MAX`, and `COUNT`. The identity does not hold for an aggregate function that does not ignore `NULL` inputs, such as `ARRAY_AGG`.

### Measure Evaluation: `AGG` (RESERVED)

Ossie SQL reserves the function name `AGG` for evaluating a measure: a column that holds an aggregate calculation instead of a value for each row. The [Relational Query Interface](relational_semantics.md) defines measures (Section 4) and `AGG` (Section 6), including its valid arguments. In `OSSIE_SQL_2026` expressions, an implementation MUST NOT give `AGG` any other meaning. Expressions in other dialects are not affected. Because function names should be case insensitive, the reservation covers every capitalization, such as `agg` and `Agg`.

This version reserves the name only. `OSSIE_SQL_2026` expressions MUST NOT call `AGG` until a future version defines where model declarations may use it.

**Compatibility.** Earlier versions of this specification did not reserve `AGG`, so an older `OSSIE_SQL_2026` expression might call a different function by that name. To update it, rename that function or write the expression in a vendor dialect. Reserving `AGG` as a function name does not prevent a field, metric, or column from being named `agg`.

### Decomposability Reference

For multi-stage aggregation (see [Ossie Analytical Context Extension](https://docs.google.com/document/d/1MKNySGmEv_C6CzBZ7um9Ym3_mMvmOolpDuwPvRzQ1bo/edit?usp=sharing)):
Expand Down Expand Up @@ -853,6 +864,7 @@ Implementations MAY support additional functions through dialect extensions. The
| Version | Date | Changes |
|:----------|:-----------| :---- |
| 0.2.0.dev | 2026-07-15 | Initial draft |
| 0.2.0.dev | 2026-10-29 | State that function names are case insensitive. Reserve `AGG` for measure evaluation; expressions that call another function named `AGG` must rename it or move to a vendor dialect |

---

Expand Down
Loading