Repository navigation
feature(core-spec): Reserve METRIC() for metric definition - #774
Open
christianeu-db wants to merge 3 commits into
Open
christianeu-db wants to merge 3 commits into
christianeu-db wants to merge 3 commits into
Conversation
christianeu-db
added a commit
to christianeu-db/ossie
that referenced
this pull request
Nov 20, 2026
Co-authored-by: Isaac <no-reply@databricks.com>
Reserve the function name METRIC in OSSIE_SQL_2026 for metric definition, as the counterpart of AGG: METRIC defines a measure, and AGG evaluates one. OSSIE_SQL_2026 expressions must not call METRIC. A dataset-scoped metric's expression is the operand of METRIC, because the metrics declaration already defines the measure, so SUM(amount) needs no METRIC() wrapper. The reservation applies only to OSSIE_SQL_2026. In the Relational Query Interface, propose METRIC(<aggregate expression>) AS name in place of the TO MEASURE marker. Define its signature, operand, kind, and placement: METRIC is not an aggregate function, so the aggregates in its operand stay unevaluated and do not make the query aggregated, and METRIC() is permitted only as a complete select item of an unaggregated SELECT. Update the examples, and record in Appendix D why a function call replaces the postfix marker. Co-authored-by: Isaac <no-reply@databricks.com>
christianeu-db
force-pushed
the
reserve-metric-function
branch
from
November 20, 2026 04:48
49fe316 to
0645c87
Compare
christianeu-db
marked this pull request as ready for review
November 20, 2026 04:56
Resolve conflicts with apache#726 (AGG(source.measure) in dataset-scoped metrics): - expression_language.md: keep upstream's AGG row and add the METRIC row to "Not Supported in Expressions"; keep upstream's version rows and add the METRIC row after them. - relational_semantics.md: take upstream's Section 3.4 measure row and add that the metric's expression is the operand of METRIC(). - docs/spec_changes.md: keep the apache#726 entry before the apache#774 entry. Co-authored-by: Isaac <no-reply@databricks.com>
- relational_semantics.md Section 5.1: state that this version has no anonymous measures, and that relaxing the placement rule is additive. - relational_semantics.md Appendix D: record that METRIC is not a function or reserved word in the engines checked. - expression_language.md: add a Compatibility paragraph for METRIC, as for AGG; a field, metric, or column can still be named metric. - ost/docs/ost.md: createView defines measures with METRIC(), not TO MEASURE AS. Co-authored-by: Isaac <no-reply@databricks.com>
Contributor
Author
|
To respond to JB's feedback on https://lists.apache.org/thread.html/hb6xvjbch7lwp1hl8ytdt64034nt577o:
|
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.
Summary
Reserve
METRIC()inOSSIE_SQL_2026as the counterpart toAGG()in the Layer 2 Relational Query Interface:METRIC(<aggregate expression>)defines a measure without evaluating it.AGG(measure)evaluates a measure in the consuming query.METRIC()is permitted only as a complete select item in an unaggregatedSELECT.Dataset-scoped metric expressions remain unchanged: the
metricsdeclaration implicitly defines a measure, soSUM(amount)is valid without an explicitMETRIC()wrapper.This replaces the previously proposed
TO MEASUREsyntax. The function form makes the operand boundary explicit and provides a symmetric definition/evaluation pair.Scope
This PR updates the Layer 1 reservation and the Layer 2 proposal. It introduces no new YAML constructs or changes to existing dataset declarations.
Validator enforcement will follow separately, consistent with the earlier
AGG()reservation (#662).Related
TO MEASUREwas proposedAGG()AGG(dataset.metric)in model-scoped metricsSpecification
core-spec/and follow the existing structure[DISCUSS]thread ondev@with a stated end date, and reach lazy consensus (or pass a[VOTE]) before merge - https://lists.apache.org/thread.html/9hnv6x6jv9vqoycp5d0mqs1gkj22482pdocs/spec_changes.mdrecords rationale, compatibility and migration impact, or the PR explains why no entry is needed - keyword was not reserved priorAI disclosure
Per the ASF Generative Tooling Guidance, this contribution was prepared with AI assistance. I have reviewed and verified every change.