Skip to content

feat(core-spec): rename expression.dialects to nonportable_dialects (breaking) - #817

Open
MrBlack1995 wants to merge 2 commits into
apache:mainfrom
MrBlack1995:feat/core-spec-nonportable-dialects
Open

MrBlack1995 wants to merge 2 commits into
apache:mainfrom
MrBlack1995:feat/core-spec-nonportable-dialects

Conversation

@MrBlack1995

@MrBlack1995 MrBlack1995 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Rename the dialects key of an expression to nonportable_dialects.

OSSIE_SQL_2026, written in the top-level sql, is the only expression language the specification defines. Every other dialect is opaque to it, and implementations MAY ignore it. In the file, however, the list of those entries is called dialects and sits next to sql as a peer. #522 renamed custom_extensions to nonportable_extensions so that the name says which side of that line a field is on. This PR does the same for the dialect entries.

# before
expression:
  sql: SUM(order.sales)
  dialects:
    - dialect: SNOWFLAKE
      expression: SUM(order.sales)

# after
expression:
  sql: SUM(order.sales)
  nonportable_dialects:
    - dialect: SNOWFLAKE
      expression: SUM(order.sales)

It is a pure rename with no alias, the approach of #522:

  • Schema and specification: core-spec/ossie-schema.json (Expression.properties and its anyOf), spec.md, spec.yaml, expression_language.md, relational_semantics.md, and the examples in docs/index.md and examples/.
  • Validator: validate.py reads nonportable_dialects; a document that still writes dialects fails schema validation ("Additional properties are not allowed ('dialects' was unexpected)").
  • Python package: the model field OssieExpression.dialects becomes OssieExpression.nonportable_dialects.
  • OST, compliance: the expander, the .ost scripts, the portability fixtures (M0 to M8) and the grader use the new key.
  • Changelog: a Breaking entry in the spec.md changelog (0.3.0.dev0) and a row in docs/spec_changes.md.

What does not change

  • The entries themselves (dialect, expression) and the dialect tokens.
  • The rule that at least one of sql or the list must be present, so an expression with only the list is still valid.
  • The rule that the top-level sql is authoritative over an OSSIE_SQL_2026 entry in the list. Whether such an entry should still be allowed there is a separate question and not part of this PR.
  • Names that are not the key: the catalog extensions/dialects.md, the dialect field of an entry, the validator's internal names, and the notes about the root-level dialects array that fix(core-spec): drop root-level dialects and vendors from the schema #397 removed.

Impact

Validation

  • On the branch rebased onto main at d27a6be, Python 3.12: validation/tests: 1104 passed, 1 skipped. python/tests: 345 passed. scripts/tests: 15 passed. compliance: 58 passed. ost unit tests: 182 passed; ost tests/scripts and the compliance query scripts exit 0. validation/test_validate.py: OK.
  • validate.py gives the same result as on main for every file under examples/ and every portability fixture.
  • One expected value changed in a test: the portability report prints the share of a document that nonportable_extensions takes, measured over the document's text. The key is longer, so that share in the test model goes from 13.7% to 12.8%.
  • ruff format rewrapped a few statements in files this PR touches, where the longer key or earlier commits left lines unformatted. ruff check and ruff format --check pass.

Related Issues

dev@ discussion: [DISCUSS] thread, lazy consensus until Tuesday 1 December 2026 (UTC).

Follows #522 and #617.

Checklist

Specification

  • Spec changes are included in core-spec/ and follow the existing structure
  • Spec changes have a [DISCUSS] thread on dev@ with a stated end date, and reach lazy consensus (or pass a [VOTE]) before merge (thread open until 2026-12-01)
  • Breaking changes to the spec are clearly called out in the summary
  • For a material spec change, docs/spec_changes.md records rationale, compatibility and migration impact, or the PR explains why no entry is needed

Converters

  • Spec or ontology changes that affect converters have a matching issue or PR in apache/ossie-converters (the rename there goes with the pin bump that picks this up; see Impact)

Validation

  • Validation rules in validation/ are updated if the spec changed
  • New validation cases are covered by tests

Documentation

  • docs/ is updated to reflect any user-facing changes

Examples

  • examples/ are added or updated for any new spec constructs

Tests

  • All existing tests pass (pytest / CI green)

Compliance

  • ASF license headers are present on all new source files (no new files)

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

Can you please rebase from main? Several conflicts will need to be addressed.

Comment thread docs/spec_changes.md Outdated
| 2026-11-13 | Core / Expression language [#703](https://github.com/apache/ossie/pull/703) | **`AGG(dataset.metric)` in model-scoped metrics.** A model-scoped metric can evaluate a dataset-scoped metric, so a model reuses the metric instead of repeating its definition. | Additive. The argument is a single `dataset.metric` reference, and the call takes no `FILTER (WHERE ...)` clause. A model-scoped metric cannot refer to a metric in any other way. Consumers that read model-scoped metrics must resolve `AGG(dataset.metric)`. Existing documents need no change. |
| 2026-11-13 | Core / Ontology [#705](https://github.com/apache/ossie/pull/705) | **A key, and an ontology list of names or expressions, names each thing once.** A key is the set of fields it names, and a supertype, identifying relationship, constraint or verbalization pattern given twice says nothing the first already said. | **Validation becomes stricter.** `primary_key` and each `unique_keys` definition reject a repeated field, as do the ontology's `extends`, `identify_by` and `verbalizes` lists and `requires` and `derived_by` wherever they appear. Field names resolve case-insensitively, so `[email, EMAIL]` repeats one field; that case is reported by the validator rather than the schema. Remove the duplicate entry; a document that had one declared less than it appeared to. A `unique_keys` definition that restates another remains valid and is reported as a warning. |
| 2026-11-20 | Core / Expression language [#726](https://github.com/apache/ossie/pull/726) | **`AGG(source.measure)` in dataset-scoped metrics.** When a dataset's `source` is a measure relation, a dataset-scoped metric can compose a source measure into its expression, so a model reuses the measure instead of repeating its definition. The measure keeps the rows that it aggregates and their row identity, and is evaluated when a consuming query evaluates the metric. A `source` is a measure relation only if every query reads one multiset of rows, can group and filter every measure by every other column, and can join the `source` with no duplication in a measure. | Additive. Document validation checks only the form of each `AGG` call. A consumer that generates SQL against a dataset's `source` must reject a metric or field that refers to a source measure outside `AGG`, and a metric that calls `AGG` on a column that is not a measure of the `source`. It must not replace `AGG` with an ordinary aggregate, and may reject a `source` that it does not support. Existing documents need no change. |
| 2026-12-03 | Core [#817](https://github.com/apache/ossie/pull/817) | **`expression.dialects` is renamed to `nonportable_dialects`.** `OSSIE_SQL_2026`, written in the top-level `sql`, is the only expression language this specification defines; every other dialect is opaque and implementations MAY ignore it. The key now says so, as `nonportable_extensions` does since [#522](https://github.com/apache/ossie/pull/522) (dev@ thread TBD). | **Breaking within unreleased `0.3.0.dev0`.** Rename the key `dialects` to `nonportable_dialects` in every expression; the old name is not accepted and there is no alias. Nothing else changes: the entries, the rule that at least one of `sql` or the list is present, and the rule that `sql` is authoritative over an `OSSIE_SQL_2026` entry are the same. The Python model field `OssieExpression.dialects` is renamed with it. Converters rename the key they read and write. |

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.

Now that the [DISCUSS] thread is live, we can replace (dev@ thread TBD) using the same format as row above:

([dev@ lazy consensus](https://lists.apache.org/thread/h0fot53f9df1v3x4rk1sgs3njwn302s0))

Also note the lazy consensus end date in the email is 2026-12-01 (currently 2026-12-03 here), let's update this date to the actual merge date when landing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 8e92f42: the row links the thread, and the date is 2026-12-02 for now. I will set it to the actual date when it lands.

Comment thread python/src/ossie/models.py Outdated
Comment on lines +282 to +284
def _require_sql_or_dialects(self) -> "OssieExpression":
if self.sql is None and not self.dialects:
raise ValueError("expression requires at least one of 'sql' or 'dialects'")
if self.sql is None and not self.nonportable_dialects:
raise ValueError("expression requires at least one of 'sql' or 'nonportable_dialects'")

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.

Heads-up: #651 changed line 282 on main to def _require_sql_or_dialects(self) -> OssieExpression:, so this hunk will conflict on rebase.

When resolving it, consider renaming the private validator method as well so it matches the field and error messages:

        @model_validator(mode="after")
        def _require_sql_or_nonportable_dialects(self) -> OssieExpression:
            if self.sql is None and not self.nonportable_dialects:
                raise ValueError("expression requires at least one of 'sql' or 'nonportable_dialects'")
            return self

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Renamed in 8e92f42 to _require_sql_or_nonportable_dialects. The conflict with #651 is resolved by the rebase onto main.

…breaking)

OSSIE_SQL_2026, written in the top-level `sql`, is the only expression
language the specification defines. Every other dialect is opaque to it and
implementations MAY ignore it, but in the file the list of those entries was
called `dialects`, a peer of `sql`. apache#522 renamed `custom_extensions` to
`nonportable_extensions` so that the name says which side of that line a
field is on; this does the same for the dialect entries.

Pure rename, no alias, as in apache#522: the schema, the specification and its
examples, the validator, the Python model field, the OST expander, the
portability fixtures and the grader read and write `nonportable_dialects`.
The entries, the rule that at least one of `sql` or the list is present, and
the rule that `sql` is authoritative over an OSSIE_SQL_2026 entry are
unchanged. A document that still uses `dialects` fails schema validation.

Breaking within the unreleased 0.3.0.dev0; recorded in the spec.md changelog
and in docs/spec_changes.md.

Co-authored-by: Isaac <no-reply@databricks.com>
@MrBlack1995
MrBlack1995 force-pushed the feat/core-spec-nonportable-dialects branch from 2f9bee6 to 6245db8 Compare November 24, 2026 12:38
… model validator

The docs/spec_changes.md row for the rename links the lazy consensus thread
and carries the first possible landing date. The private validator of
OssieExpression is named after the field it checks.

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

djwaldo commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

+1 on the rename and on the reasoning behind it. A name that says which side of
the portable line a field sits on is worth a breaking change in an unreleased
version, and this is the same shape as #522.

Taking you up on the converter offer. There is one property of this rename worth
settling before the pin moves, because it decides how the work has to be
sequenced.

The writer has no window. Expression in the currently pinned schema is
additionalProperties: false, with anyOf: [required sql, required dialects].
So a converter cannot begin writing the new key early, the way a reader can
begin accepting it early. Checked against the pin on converters main (d27a6be):

OLD key  dialects             -> VALID
NEW key  nonportable_dialects -> REJECTED: Additional properties are not allowed
                                 ('nonportable_dialects' was unexpected)
NEW key + sql                 -> REJECTED: Additional properties are not allowed
                                 ('nonportable_dialects' was unexpected)

The third line is the one that matters. The new key is rejected even beside a
valid sql, so there is no half-step available: every converter's writer flips
in the same commit as the pin bump, or it emits documents that fail validation.

That is how #522 actually landed, and it seems worth copying rather than
rediscovering. ossie-converters#247 bumped the pin and adapted the converters in
one commit, not two.

Readers are the opposite, and that is where the cheap win is. A reader can
accept both names today, at no cost and with no coordination, because the old
name is still the valid one. Our stash.py does exactly this for #522, and the
rationale generalises: read either name, write the new one, and refuse a
document carrying both rather than resolving by precedence. Two lists stop being
alternative spellings of one fact once they both exist, and silently reading one
while extending the other drops whatever was in the loser.

On scale, 26 of the 28 converters reference dialects under src/, and 27 do
including tests. So the atomic commit is a large one. Landing the reader half
ahead of it is what keeps it tractable.

Happy to take thoughtspot. The reader-tolerance half could land ahead of the
pin bump as its own PR, so that the atomic commit is writers only and others can
follow the same split, if the list likes that shape.

@MrBlack1995

Copy link
Copy Markdown
Contributor Author

Thanks for checking this against the pin, and for taking thoughtspot.

I agree with the sequencing. I reproduced the three results against d27a6be: Expression has additionalProperties: false, so the new key is rejected at the current pin, also next to a valid sql. The writers can therefore only change together with the pin bump, in one commit, as in ossie-converters#247.

Accepting both names in the readers ahead of the bump works for me, with the rule you describe: read either name, write the new one from the bump on, and refuse a document that carries both. Two notes on that:

  1. It is a transition aid in the converters, not an alias in the specification. After the bump a document with dialects fails validation, so a reader meets the old name only in documents written before the rename. Whether a converter keeps the tolerant reader afterwards is its own choice.
  2. The reader PRs are optional. A converter without one changes its reader in the bump commit, which is what happened for feat(core-spec): nonportable_extensions object data with portability and quoting rules (breaking) #522.

What I will do: once this PR has merged, I prepare the pin bump with the writers, fixtures and tests for every converter that has not been taken by then, and I open the reader half for the converter I work on ahead of it. Your count matches mine: 26 of the 28 converters reference the key under src/, 27 with tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants