Skip to content

docs(core-spec): Reserve AGG() in Ossie SQL - #662

Merged
christianeu-db merged 2 commits into
apache:mainfrom
justint-db:reserve-agg
Nov 3, 2026
Merged

christianeu-db merged 2 commits into
apache:mainfrom
justint-db:reserve-agg

Conversation

@justint-db

@justint-db justint-db commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Reserve AGG. Ossie SQL reserves the function name AGG for evaluating a measure, as defined by the Relational Query Interface (Sections 4 and 6). Implementations and dialect extensions must not give it another meaning. This change reserves the name only. Where model declarations may use AGG is left to a future version (docs(core-spec): Let dataset-scoped metrics reference source columns as source.column #633 proposes one use).
  • Compatibility note. Earlier versions did not reserve AGG, so an older OSSIE_SQL_2026 expression might call a different function by that name. Fields, metrics, and columns can still be named agg.
  • Function names should be case insensitive, matching the existing rule for regular identifiers. As suggested on the list, this is stated as a general rule, so it also covers existing functions.

Only core-spec/expression_language.md changes.

Related Issues

Split from #633.

Checklist

Specification

  • Spec changes are included in core-spec/ and follow the existing structure
  • Spec changes have been discussed on the mailing list or in a linked issue
  • Breaking changes to the spec are clearly called out in the summary (see the compatibility note)

Reserve the function name AGG for measure evaluation, as defined by the
Relational Query Interface, and add a compatibility note for older
expressions that call a different function named AGG. State that
function names should be case insensitive, like regular identifiers.

Where model declarations may use AGG is left to a future version.

Co-authored-by: Isaac <no-reply@databricks.com>
jbonofre
jbonofre previously approved these changes Nov 1, 2026

@jbonofre jbonofre left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @justint-db, this matches what we agreed on the dev@ mailing list (split from #633 ):

  • AGG is reserved in Ossie SQL, with a compatibility note for existing expressions calling another function named AGG
  • function names are case insensitive, so agg() and Agg() are covered too
  • function names and identifiers are separate namespaces, so a field or metric named agg still works
  • where model declarations can use AGG (dataset scoped metric, AGG over a source measure) stays in #633

A few non-blocking points we can address later:

  1. The compatibility note suggests moving an older AGG call to a vendor dialect, but the new section says a dialect extension MUST NOT define AGG. As vendor dialects are opaque (spec.md), I think the reservation should apply to OSSIE_SQL_2026 expression only.
  2. It would be good to say explicitly that AGG(...) is not allowed in OSSIE_SQL_2026 model expressions until a future version defines where it can be used (maybe in the "Not Supported in Expressions" table).
  3. Functions callable without parentheses (CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP) can collide with a field of the same name. Worth an exception in the "separate namespaces" sentence.

Limit the reservation to OSSIE_SQL_2026 expressions, since vendor
dialects are opaque, and state that OSSIE_SQL_2026 expressions must not
call AGG until a future version defines where it may be used. List it
under Not Supported in Expressions.

Drop the general claim that function names and identifiers are separate
namespaces, which has exceptions this change does not need to define.
The compatibility note keeps the narrower claim that a field, metric,
or column may still be named agg.

Co-authored-by: Isaac <no-reply@databricks.com>
@justint-db

Copy link
Copy Markdown
Contributor Author

Thanks @jbonofre! I've addressed all three in 5a953a5:

  1. Vendor dialects: the reservation now applies only to OSSIE_SQL_2026 expressions, and expressions in other dialects aren't affected. That also makes the compatibility note's advice to use a vendor dialect consistent.
  2. Not allowed yet: the section now says OSSIE_SQL_2026 expressions MUST NOT call AGG until a future version defines where model declarations may use it. I also added AGG(...) to the "Not Supported in Expressions" table.
  3. Functions called without parentheses: good catch. Defining exactly how function names and identifiers interact is outside this PR. Besides CURRENT_DATE and the like, ANSI SQL also reserves names such as COUNT and SUM, which most databases don't enforce. So I removed the general "separate namespaces" sentence. The compatibility note keeps the narrower claim that reserving AGG doesn't stop a field, metric, or column from being named agg. A follow-up could define the general rule properly.

@christianeu-db christianeu-db left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thread on AGG() has been open for a week w/ lazy consensus

@christianeu-db
christianeu-db merged commit 9b8f16c into apache:main Nov 3, 2026
1 check passed
ekut added a commit to Dactopus/dactopus-ossie-clickhouse that referenced this pull request Nov 6, 2026
A dataset's metric may read a column of its source as source.column
(apache/ossie#633). The qualifier is case insensitive, the column wins
over a field of the same name, and a dataset that declares a field named
source refuses the qualifier. validate --url checks the column, and a
metric over a column the connected user cannot read is hidden.

A call of AGG in any capitalization is refused in fields, metrics and
filters, as the spec reserves the name (apache/ossie#662). ANSI_SQL
entries are read by the same rule.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ekut added a commit to Dactopus/dactopus-ossie-clickhouse that referenced this pull request Nov 7, 2026
A dataset's metric may read a column of its source as source.column
(apache/ossie#633). The qualifier is case insensitive, the column wins
over a field of the same name, and a dataset that declares a field named
source refuses the qualifier. validate --url checks the column, and a
metric over a column the connected user cannot read is hidden.

A call of AGG in any capitalization is refused in fields, metrics and
filters, as the spec reserves the name (apache/ossie#662). ANSI_SQL
entries are read by the same rule.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants