Skip to content

feat(core-spec): decouple core spec from specific vendors - #617

Merged
christianeu-db merged 13 commits into
apache:mainfrom
christianeu-db:decouple-core-spec-from-vendor-dialects
Oct 26, 2026
Merged

christianeu-db merged 13 commits into
apache:mainfrom
christianeu-db:decouple-core-spec-from-vendor-dialects

Conversation

@christianeu-db

@christianeu-db christianeu-db commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Context

Discussion for this PR is in this thread: https://lists.apache.org/thread.html/vmgv5ffryw70wxbvtwnohhhz2zzx0ocf

Ossie is a vendor-neutral specification. Its extensibility model already reflects
this: a custom_extensions entry pairs a free-form vendor_name with a single
opaque data string. A vendor or an individual can attach any amount of extra
state, but that state is cordoned into one opaque value rather than promoted to
top-level spec fields. The core stays small and vendor-neutral, and everything
vendor-specific is opaque payload that the core carries but does not interpret.

Expressions are the one place where this principle is not yet applied. This PR
extends the same pattern to expressions and dialects. It is a spec-level change;
see the mailing-list threads under Related Issues.

1. Make the portable Ossie expression the primary field (backward-compatible)

Today an expression is a list of dialects, each a {dialect, expression} pair.
Ossie defines one portable dialect, OSSIE_SQL_2026
(core-spec/expression_language.md), but in practice it sits as just another
entry in the dialects list, peer to vendor dialects.
This is the only place in the spec where an Ossie concept and a vendor
concept appear at the same level, and the portable form is rarely authored as a
result (there are some workstreams in flight to close this gap).

This PR adds an optional top-level sql field to the expression object. It
is the primary, portable OSSIE_SQL_2026. The dialects list
remains for vendor-specific variants. When both the top-level sql and an
OSSIE_SQL_2026 entry in dialects are present, the top-level field is
authoritative. For portable-only expressions, this leads to a more concise representation
since the dialect sections / dialect type string can be dropped.

The field is optional and additive, so the change is backward-compatible: existing
documents remain valid.

Note: a prior iteration had the nesting as expression: expression: to stay consistent with the (dialect, expression) pair but the feedback on the thread from @jochenchrist pointed to the double-key nesting feeling wrong

2. Make dialect a free-form string, not an enum

dialect is currently a closed enum in core-spec/ossie-schema.json. Adding a
dialect requires a change to the core spec and a DISCUSS thread, and a dialect
outside the enum fails validation by default, so an outside party cannot register
its own dialect without a full spec change. Yet these dialects are explicitly
opaque: an implementation MAY ignore any non-OSSIE_SQL_2026 dialect, and
registering a dialect does not imply Ossie can query it.

vendor_name is already a free-form string for exactly these reasons. This PR
applies the same decoupling to dialect: enum to free-form string. One could argue
dialects belong entirely in custom_extensions, but expressions are fundamental
enough to keep as a first-class field; only the closed enumeration is removed.

Examples: expression portability before / after this PR

# Job to be done Before After
1 Publish a measure that is already fully portable ✅ Portable form must be nested as a dialect entry.
expression:
  dialects:
    - dialect: OSSIE_SQL_2026
      expression: SUM(ss_sales_price)
✅ Portable form is a first-class top-level field.
expression:
  sql: SUM(ss_sales_price)
2 Keep vendor overrides alongside a portable form ✅ Portable and vendor forms are peers; nothing marks the primary.
expression:
  dialects:
    - dialect: OSSIE_SQL_2026
      expression: SUM(ss_sales_price)
    - dialect: MAQL
      expression: "SELECT SUM({fact/store_sales.ss_sales_price})"
✅ Portable form is primary; vendor forms are optional overrides.
expression:
  sql: SUM(ss_sales_price)
  dialects:
    - dialect: MAQL
      expression: "SELECT SUM({fact/store_sales.ss_sales_price})"
3 Model an expression that cannot be made portable ✅ Vendor-only dialects, no portable form.
expression:
  dialects:
    - dialect: DATABRICKS
      expression: approx_count_distinct(session_id)
    - dialect: SNOWFLAKE
      expression: APPROX_COUNT_DISTINCT(session_id)
✅ Identical — omitting the top-level sql means "not portable."
expression:
  dialects:
    - dialect: DATABRICKS
      expression: approx_count_distinct(session_id)
    - dialect: SNOWFLAKE
      expression: APPROX_COUNT_DISTINCT(session_id)
4 Support an engine Ossie does not enumerate yet (FakeDB) ❌ Fails validation — FakeDB is not in the enum; valid only after editing core-spec/spec.yaml and regenerating the SDK types.
expression:
  dialects:
    - dialect: FakeDB
      expression: quantile_cont(latency_ms, 0.95)
✅ Valid — unknown dialect is opaque; optionally register it in extensions/dialects.md (docs only).
expression:
  dialects:
    - dialect: FakeDB
      expression: quantile_cont(latency_ms, 0.95)

Rows 1–3 are additive: every existing document stays valid and dialects
keeps working. Row 4 is the new capability, mirroring how vendor_name
already works for custom_extensions.

Why this matters

Together, the future shape is an expression whose primary, portable form is defined
once at the top level, with dialects as optional overrides. The Hex converter calls
out the variety of expression types: not every dialect is a SQL dialect - some are richer
expression languages. More broadly, there is no reason an expression could not be a
code snippet or any other evaluation detail. A closed enum is too restrictive for
that range; a free-form string is not.

Extensions registry

The dialect and vendor example constants move out of the normative spec into a new
top-level extensions/ folder (README.md, dialects.md, vendors.md). This is a
community registry of well-known tokens: a place to align on their spelling and
meaning without making any token fundamental to the spec. Presence in a list does
not imply endorsement, and new tokens can be added without a full spec review.

Changes in this PR

  • core-spec/ossie-schema.json: Dialect becomes type: string with illustrative
    examples and no enum; Vendor examples are genericized; the Expression
    object gains the optional (Ossie) sql field with its precedence rule.
  • core-spec/spec.md, spec.yaml, expression_language.md: document the free-form
    dialect, the portable sql field, and the link to extensions/; the
    opaque / declaration-only text is retained.
  • extensions/: new README.md, dialects.md, vendors.md.
  • scripts/generate-spec-types.py: no longer generates a dialects enumeration
    (dialects are free-form, like vendors); it still syncs datatypes.
  • python/ SDK: OssieDialectExpression.dialect is typed str; OssieExpression
    gains the optional sql; OssieDialect / OssieVendor remain as
    convenience constants.
  • validation/validate.py: an unregistered dialect is treated as opaque and skipped (with a warning)
    rather than parsed as ANSI SQL; the portable sql is validated as
    OSSIE_SQL_2026.
  • validation/validate.py: cleanup on validation to extract dialect logic as an iterator / incorporate feat(core-spec): support dataset-scoped metrics #591.
  • examples/tpcds_semantic_model.yaml: demonstrates the portable ossie sql field.

Scope and follow-ups

The scope is deliberately minimal. The following refinements are left for follow-up
PRs:

  • Converters: this will be a separate change in ossie-converters
  • The vendor and dialect constant code and validation should move further from the
    core — into the converters or a shared mixins package — rather than living
    alongside the core models. This can be done incrementally.
  • The OSSIE_SQL_2026 reading logic should be generalized to bias toward the primary
    top-level sql when it is defined. This PR documents that precedence in the
    spec and the reference validator honors it, but the converters are not yet updated
    to read the field.
  • Pulling the Ossie -> vendor mappings from expressions will be a follow up

Related Issues

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: https://lists.apache.org/thread.html/vmgv5ffryw70wxbvtwnohhhz2zzx0ocf
  • Breaking changes to the spec are clearly called out in the summary (none — the change is additive and relaxes validation; the SDK dialect field type changed from an enum to str)

Ontology

  • Ontology changes in ontology/ are consistent with spec changes (N/A — no ontology changes)
  • New or modified terms are defined and documented (N/A)

Converters

  • Converter change in f8d3508 will be opened in a new issue / PR in ossie-converters once this merges

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 (follow-up; see Scope)
  • New features or behaviors are documented with examples where appropriate (in core-spec/ and examples/)
  • CONTRIBUTING.md is updated if the contribution process changed (N/A)

Examples

  • examples/ are added or updated for any new spec constructs or converter support. Examples in the spec and updated a store sample

Tests

  • All existing tests pass (pytest / CI green)
  • New functionality is covered by tests

Compliance

  • ASF license headers are present on all new source files
  • No third-party dependencies are added without PMC/IPMC approval
  • If third-party source code is vendored/copied (not just declared as a dependency), NOTICE and/or LICENSE have been updated per ASF policy (N/A — no vendored third-party source)

Make the core specification vendor-neutral:

- `Dialect` becomes a free-form string (was a closed enum), mirroring the
  already-free-form `Vendor`; generic schema `examples` replace concrete
  product names.
- Move the known-dialect and known-vendor catalogs out of the normative spec
  into a new top-level `extensions/` folder (README, dialects.md, vendors.md),
  framed as a community registry whose listings do not imply endorsement.
- Add an optional top-level portable `expression` field (OSSIE_SQL_2026) to the
  expression object; when both it and an OSSIE_SQL_2026 `dialects` entry are
  present, the top-level field is authoritative. Demonstrated on
  `customer_full_name` in examples/tpcds_semantic_model.yaml.
- Keep the normative text that non-OSSIE dialects are opaque and
  declaration-only.

Kept in sync: the enum-sync generator no longer emits `dialects` (free-form,
like vendors); the Python SDK types `dialect` as a free-form string and gains
the optional portable `expression`; the reference validator treats unregistered
dialects as opaque (skipped) and validates the portable expression. Converters
are otherwise unchanged except where the now-string dialect required a fix (the
dbt dialect comparison uses `==`, and the sigma and hex converters no longer
call `.value` on a dialect) and where the new portable `expression` is handled:
the ontology converter carries it through its model and both conversion
directions, and omni's round-trip test documents the portable marker as a
normalization (its text survives as the dialect entry).

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

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

I read this alongside the list thread and merged it locally onto current main (b42ce09), no conflicts. Three things on the code; the design points are on the list.

The hex check job fails at the head: ty check reports invalid-argument-type at load_ossie_dialect_expression.py:79, where _to_sqlglot_dialect(ossie_dialect: OssieDialect) now receives the str that OssieDialectExpression.dialect became. The runtime side matters more: that function ends in assert_never, so a document with a dialect outside the old enum, which this PR makes valid, raises AssertionError: Expected code to be unreachable, but got: 'DB_DIALECT' on export. I ran it directly with DB_DIALECT and SNOWFLKE; both raise. The wisdom test you added covers this case; hex needs the same, with the final branch returning None for anything unregistered and the parameter typed str.

Expression still lists dialects under required with minItems: 1, and OssieExpression.dialects keeps Field(..., min_length=1), so a portable-only document fails both the schema and the SDK:

[Schema] datasets -> 0 -> fields -> 0 -> expression: 'dialects' is a required property

A required of one of expression or dialects (anyOf) in the schema and a model validator in the SDK would match the behaviour the summary describes.

With #612 cherry-picked on top, the two tests that read $defs.Dialect.enum fail with KeyError (validation test_every_schema_dialect_is_mapped_or_skipped, Holistics test_every_schema_dialect_is_parsed_or_marked_not_sql); the table cross-check and the sqlglot reader tests pass. I can point those two at the table in extensions/dialects.md instead, in whichever order the two PRs land.

christianeu-db and others added 3 commits October 21, 2026 17:21
…from-vendor-dialects

# Conflicts:
#	converters/dbt/src/ossie_dbt/ossie_to_msi.py
#	converters/hex/src/ossie_hex/ossie_to_hex/load_ossie_expression.py
#	converters/hex/src/ossie_hex/ossie_to_hex/pick_ossie_dialect_expression.py
#	converters/hex/tests/ossie_to_hex/test_pick_ossie_dialect_expression.py
#	converters/microsoft/tests/test_semantic_model_to_ossie.py
#	converters/omni/tests/_util.py
#	converters/ontology/src/ossie_ontology/converter/ossie_to_spec/converter.py
#	converters/ontology/src/ossie_ontology/converter/spec_to_ossie/converter.py
#	converters/ontology/src/ossie_ontology/model.py
#	converters/ontology/src/ossie_ontology/spec.py
#	converters/sigma/src/ossie_sigma/ossie_to_sigma.py
#	converters/wisdom/tests/test_ossie_to_wisdom.py
#	converters/wisdom/tests/test_wisdom_to_ossie.py
An Expression required `dialects` on both the JSON Schema and the SDK, so a
document carrying only the portable top-level `expression` (OSSIE_SQL_2026) was
rejected, contradicting the spec's stated semantics.

- Schema: replace `required: [dialects]` with an anyOf requiring at least one of
  `expression` or `dialects`; `dialects` keeps `minItems: 1` when present.
- SDK: make `OssieExpression.dialects` optional and add a model_validator that
  rejects an expression carrying neither form.
- Tests: cover portable-only, dialects-only, both-present, and the empty cases
  on both the schema and the SDK.
- Docs: note the "at least one" rule in spec.md and spec.yaml.

Co-authored-by: Isaac <no-reply@databricks.com>
An unrecognized dialect is opaque and legitimate under the free-form `Dialect`
model, so its SQL cannot be parse-checked. The validator skipped it silently,
which also hid typos such as `SNOWFLKE`.

`validate_sql` now tallies expressions whose dialect is not in `DIALECT_MAP` and
emits one nonfatal `ValidationWarning` per distinct unknown dialect, with the
count of affected expressions. Validation still passes. Known-but-unparseable
dialects (MDX, DAX, HOLISTICS_AQL, ...) stay silent, and the per-call
`validate_sql_expression` is unchanged.

Co-authored-by: Isaac <no-reply@databricks.com>
christianeu-db and others added 3 commits October 22, 2026 17:06
Brings in the merged apache#591 (dataset-scoped metrics), apache#486 (name
resolution), apache#614 and apache#619. Resolved conflicts:

- python/src/ossie/models.py: union the pydantic imports
  (model_validator + SerializationInfo + TypeAdapter).
- core-spec/spec.yaml, core-spec/spec.md: keep both the portable
  expression/dialects presence note and the upstream name-resolution
  notes; they are complementary.
- validation/validate.py (semantic, not a text conflict): the shared
  _parse_sql_expression from apache#591 returns a (tree, error) tuple, so the
  unknown-dialect skip must return (None, None), not a bare None. This
  also makes validate_metric_scoping treat an unknown dialect as opaque.

Co-authored-by: Isaac <no-reply@databricks.com>
The portable top-level key of the Expression object was `expression`,
nested under a field/metric's own `expression:` block -- the doubled
`expression.expression` Jochen flagged on the thread. Rename it to
`sql` so the key reads cleanly and names what it holds: the portable
OSSIE_SQL (OSSIE_SQL_2026) form.

Scope is the portable key only. The field/metric `expression:` key
(which holds the Expression object) and the per-dialect
`dialects[].expression` key (already qualified by its `dialect:`) are
unchanged.

This key was introduced by this same unreleased PR, so the rename
carries no migration burden; no released spec ever had
`expression.expression`. No back-compat alias -- the old key is
rejected (schema additionalProperties:false, SDK extra=forbid).

Touches the schema anyOf + property, the SDK model and validator, the
validator's portable reads, spec.md/spec.yaml/docs prose and examples,
the tpcds portable example, and the mirrored tests.

Co-authored-by: Isaac <no-reply@databricks.com>
A dataset-scoped metric may be written with only the portable `sql`
form (no dialects). Such a metric escaped both checks: `validate_sql`
only walked its `dialects`, so the portable form was never parsed; and
`validate_metric_scoping` likewise only walked `dialects`, so the
single-namespace scoping rules (no qualified references, declared
fields only) were never applied to it.

Both now handle the portable `sql` exactly like a dialect expression:
it is parsed as OSSIE_SQL_2026 and scope-checked. A portable-only
dataset-scoped metric with a cross-dataset reference or an undeclared
field is now reported, as a dialect form already was.

Adds four tests covering the portable form: a declared single-part
field passes, a cross-dataset reference and an undeclared field are
rejected, and an invalid portable expression is reported.

Co-authored-by: Isaac <no-reply@databricks.com>
@christianeu-db
christianeu-db force-pushed the decouple-core-spec-from-vendor-dialects branch 3 times, most recently from c1c223d to c049fdb Compare October 22, 2026 23:41
christianeu-db added a commit to christianeu-db/ossie-converters that referenced this pull request Nov 2, 2026
Bumps the ossie submodule to a498fce, which includes apache/ossie#617:
`dialect` is a free-form string, `dialects` is optional, and the expression
object gains an optional portable `sql`. This restores the seven converters
that failed against the new pin; reading `sql` is left as a follow-up.

- hex: treat a dialect outside the well-known `OssieDialect` values as
  opaque instead of raising (`assert_never` failed on e.g. `DB_DIALECT`).
  hex also tolerates `dialects` being absent, as its type check requires.
- dbt: use the dialect string directly, so every dialect is valid, and
  compare dialects by value, not identity.
- sigma: stop calling `.value` on a dialect, which is a `str` now.
- wisdom: compare dialects by value in tests.
- ontology: accept `expression.sql`; it is not converted.
- omni: the tpcds round trip normalizes `expression.sql` away.
- microsoft: remove `test_dax_is_a_spec_dialect`, which read the removed
  `$defs.Dialect.enum`; every dialect string is valid now.

Fixes apache#61

Co-authored-by: Isaac <no-reply@databricks.com>
christianeu-db added a commit to christianeu-db/ossie-converters that referenced this pull request Nov 2, 2026
Since apache/ossie#617, `expression.dialects` is optional and an
expression may carry only the portable `sql`. dbt, sigma, wisdom and the
salesforce converter read `dialects` unguarded and failed on such a
document (`TypeError: 'NoneType' object is not iterable`, a
`NullPointerException` in salesforce). snowflake, nvidia and holistics
aborted the whole conversion, although the same document with only an
unregistered dialect converts. hex and omni already dropped the field or
metric with a diagnostic.

Treat an absent `dialects` as an expression with nothing to convert, so
the field or metric is dropped with a diagnostic until a follow-up reads
`sql`:

- dbt: the metric is dropped with UNSUPPORTED_METRIC_EXPRESSION.
- sigma: fields get EXPRESSION_NOT_TRANSLATABLE and the metric is dropped.
  The diagnostic that lists the available dialects needed the same guard.
- wisdom: a field or metric without dialect entries is skipped with
  MISSING_DIALECT_EXPRESSION. Wisdom has no drop path today and fell back
  to `dialects[0]`, which does not exist here, so it needs an explicit skip.
- snowflake: skipped with a warning, as for an unsupported dialect.
- nvidia: skipped with a warning.
- holistics: dropped with a HOLISTICS_NO_USABLE_DIALECT error. The body is
  picked before the block is built, so a dropped field does not also report
  an assumed type.
- salesforce: the field is omitted with a warning. This change is not
  compiled or tested here, because the build needs Maven.

An expression with neither `sql` nor `dialects` still raises in snowflake,
nvidia and holistics.

Co-authored-by: Isaac <no-reply@databricks.com>
akrish1982 added a commit to akrish1982/ossie that referenced this pull request Nov 2, 2026
Register PYICEBERG the way apache#617 lays out: a row in extensions/dialects.md,
a NON_SQL_DIALECTS entry so the validator carries its expressions without
parsing them, and the well-known value on OssieDialect.

PYICEBERG is the predicate string accepted by PyIceberg's expression
parser, for boolean fields. Its reference, with the supported predicates,
operand rules and PyIceberg 0.10.0 as the minimum reference version, moves
to extensions/dialects/pyiceberg.md, so the PR no longer touches the core
spec.

sqlglot's default reader accepts most PyIceberg strings and also the
function calls PyIceberg rejects, so the dialect is listed as non-SQL
rather than validated as SQL.

Closes apache#142

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@akrish1982 akrish1982 mentioned this pull request Nov 2, 2026
10 of 19 tasks
zackm-solid added a commit to zackm-solid/ossie-converters that referenced this pull request Nov 9, 2026
The spec now lets an expression carry its portable OSSIE_SQL_2026 form
as a top-level `sql`, alone or beside `dialects`, and makes it
authoritative over an OSSIE_SQL_2026 entry there. Export read only
`dialects`, so a valid sql-only expression raised "has no expression".
It is now read as the OSSIE_SQL_2026 form, keeping the existing order
(selected dialect, then ANSI_SQL, then OSSIE_SQL_2026); when it and an
OSSIE_SQL_2026 entry differ, the top-level `sql` wins with a warning.
Import keeps writing `dialects`, since a Solid formula is warehouse SQL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
christianeu-db pushed a commit that referenced this pull request Nov 10, 2026
Register PYICEBERG the way #617 lays out: a row in extensions/dialects.md,
a NON_SQL_DIALECTS entry so the validator carries its expressions without
parsing them, and the well-known value on OssieDialect.

PYICEBERG is the predicate string accepted by PyIceberg's expression
parser, for boolean fields. Its reference, with the supported predicates,
operand rules and PyIceberg 0.10.0 as the minimum reference version, moves
to extensions/dialects/pyiceberg.md, so the PR no longer touches the core
spec.

sqlglot's default reader accepts most PyIceberg strings and also the
function calls PyIceberg rejects, so the dialect is listed as non-SQL
rather than validated as SQL.

Closes #142

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
christianeu-db added a commit to christianeu-db/ossie-converters that referenced this pull request Nov 10, 2026
Bumps the ossie submodule to a498fce, which includes apache/ossie#617:
`dialect` is a free-form string, `dialects` is optional, and the expression
object gains an optional portable `sql`. This restores the converters
that failed against the new pin; reading `sql` is left as a follow-up.

- hex: tolerate an absent `dialects`. A field or metric that has only `sql`
  is omitted with an error, where hex raised `TypeError` before. Tests expect
  the dialect in warnings as a `str`, which the new SDK gives.
- dbt: use the dialect string directly, so every dialect is valid, and
  compare dialects by value, not identity.
- sigma: stop calling `.value` on a dialect, which is a `str` now.
- wisdom: compare dialects by value in tests.
- lightdash: compare dialects by value in tests.
- ontology: accept `expression.sql`; it is not converted.
- omni: the tpcds round trip normalizes `expression.sql` away.
- microsoft: remove `test_dax_is_a_spec_dialect`, which read the removed
  `$defs.Dialect.enum`; every dialect string is valid now.

Fixes apache#61

Co-authored-by: Isaac <no-reply@databricks.com>
christianeu-db added a commit to christianeu-db/ossie-converters that referenced this pull request Nov 10, 2026
Since apache/ossie#617, `expression.dialects` is optional and an
expression may carry only the portable `sql`. dbt, sigma, wisdom and the
salesforce converter read `dialects` unguarded and failed on such a
document (`TypeError: 'NoneType' object is not iterable`, a
`NullPointerException` in salesforce). snowflake, nvidia and holistics
aborted the whole conversion, although the same document with only an
unregistered dialect converts. hex and omni already dropped the field or
metric with a diagnostic.

Treat an absent `dialects` as an expression with nothing to convert, so
the field or metric is dropped with a diagnostic until a follow-up reads
`sql`:

- dbt: the metric is dropped with UNSUPPORTED_METRIC_EXPRESSION.
- sigma: fields get EXPRESSION_NOT_TRANSLATABLE and the metric is dropped.
  The diagnostic that lists the available dialects needed the same guard.
- wisdom: a field or metric without dialect entries is skipped with
  MISSING_DIALECT_EXPRESSION. Wisdom has no drop path today and fell back
  to `dialects[0]`, which does not exist here, so it needs an explicit skip.
- snowflake: skipped with a warning, as for an unsupported dialect.
- nvidia: skipped with a warning.
- holistics: dropped with a HOLISTICS_NO_USABLE_DIALECT error. The body is
  picked before the block is built, so a dropped field does not also report
  an assumed type.
- salesforce: the field is omitted with a warning. This change is not
  compiled or tested here, because the build needs Maven.

An expression with neither `sql` nor `dialects` still raises in snowflake,
nvidia and holistics.

Co-authored-by: Isaac <no-reply@databricks.com>
jbonofre added a commit to apache/ossie-converters that referenced this pull request Nov 10, 2026
…/ossie#617) (#78)

* fix(converters): adapt to free-form dialects (apache/ossie#617)

Bumps the ossie submodule to a498fce, which includes apache/ossie#617:
`dialect` is a free-form string, `dialects` is optional, and the expression
object gains an optional portable `sql`. This restores the converters
that failed against the new pin; reading `sql` is left as a follow-up.

- hex: tolerate an absent `dialects`. A field or metric that has only `sql`
  is omitted with an error, where hex raised `TypeError` before. Tests expect
  the dialect in warnings as a `str`, which the new SDK gives.
- dbt: use the dialect string directly, so every dialect is valid, and
  compare dialects by value, not identity.
- sigma: stop calling `.value` on a dialect, which is a `str` now.
- wisdom: compare dialects by value in tests.
- lightdash: compare dialects by value in tests.
- ontology: accept `expression.sql`; it is not converted.
- omni: the tpcds round trip normalizes `expression.sql` away.
- microsoft: remove `test_dax_is_a_spec_dialect`, which read the removed
  `$defs.Dialect.enum`; every dialect string is valid now.

Fixes #61

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

* fix(converters): tolerate expressions that carry only sql

Since apache/ossie#617, `expression.dialects` is optional and an
expression may carry only the portable `sql`. dbt, sigma, wisdom and the
salesforce converter read `dialects` unguarded and failed on such a
document (`TypeError: 'NoneType' object is not iterable`, a
`NullPointerException` in salesforce). snowflake, nvidia and holistics
aborted the whole conversion, although the same document with only an
unregistered dialect converts. hex and omni already dropped the field or
metric with a diagnostic.

Treat an absent `dialects` as an expression with nothing to convert, so
the field or metric is dropped with a diagnostic until a follow-up reads
`sql`:

- dbt: the metric is dropped with UNSUPPORTED_METRIC_EXPRESSION.
- sigma: fields get EXPRESSION_NOT_TRANSLATABLE and the metric is dropped.
  The diagnostic that lists the available dialects needed the same guard.
- wisdom: a field or metric without dialect entries is skipped with
  MISSING_DIALECT_EXPRESSION. Wisdom has no drop path today and fell back
  to `dialects[0]`, which does not exist here, so it needs an explicit skip.
- snowflake: skipped with a warning, as for an unsupported dialect.
- nvidia: skipped with a warning.
- holistics: dropped with a HOLISTICS_NO_USABLE_DIALECT error. The body is
  picked before the block is built, so a dropped field does not also report
  an assumed type.
- salesforce: the field is omitted with a warning. This change is not
  compiled or tested here, because the build needs Maven.

An expression with neither `sql` nor `dialects` still raises in snowflake,
nvidia and holistics.

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

* fix(dbt): read the top-level sql of an expression

A field whose expression carries only `sql` has no `dialects` entry, so
the lookup found nothing and the field was emitted with `expr: ""`.
MetricFlow reads an empty `expr` as the element name, so `amount_usd`
with `sql: amount * 1.1` silently became the column `amount_usd`.

Treat `sql` as an OSSIE_SQL_2026 candidate in the dialect lookup. It
ranks after the converter's own dialect and wins over an OSSIE_SQL_2026
entry, as the spec requires. Fields and metrics both read it, so a
`sql`-only metric is now converted and no longer dropped.

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

* fix(converters): read the top-level sql in ontology, nvidia and salesforce

A field whose expression carries only `sql` lost that expression in
three converters:

- ontology: `spec_to_ossie` copied only `dialects`, so the field read
  the column it is named after. `ossie_to_spec` then wrote
  `expression: {}`, which the core schema rejects.
- nvidia: the field was skipped. A key or a relationship that named it
  then pointed at a column the table does not have.
- salesforce: the field was omitted. A primary key field counts as
  covering the key, so the key and every relationship joining on it
  were also lost.

Read `sql` as an OSSIE_SQL_2026 expression, as dbt does. It wins over an
OSSIE_SQL_2026 entry, as the spec requires, and ranks after the dialect
each converter prefers (ANSI_SQL in nvidia, TABLEAU in salesforce). In
ontology it becomes the first entry, so it is written back under
`dialects`. Writing it back as `sql` is left to #79.

salesforce is not compiled or tested here, because the build needs
Maven and JDK 21.

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

* fix(holistics): render a sql-only expression instead of dropping it

Dropping the dimension left the primary key and any relationship naming
it pointing at a dimension that was never written, so the conversion
succeeded with AML referencing a missing field. Before the pin bump the
same input was a ConversionError.

The top-level `sql` is OSSIE_SQL_2026, which pick_body already renders
through its portable path. dialects_of now exposes it as the
OSSIE_SQL_2026 body, replacing an OSSIE_SQL_2026 entry as the spec
requires, and pick_body and its callers go back to their shape on main.

---------

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: JB Onofré <jbonofre@apache.org>
@jdavidson jdavidson mentioned this pull request Nov 11, 2026
6 of 7 tasks
shubhambatlan added a commit to shubhambatlan/ossie-converters that referenced this pull request Nov 12, 2026
…ext refs

Since apache/ossie#617 an expression may carry only `sql` (OSSIE_SQL_2026),
and `sql` is authoritative over an OSSIE_SQL_2026 entry in `dialects`.
expression_text now reads `sql` first and refuses an expression with
neither; a dataset-scoped metric promoted to a model metric falls back to
OSSIE_SQL_2026 when no dialect entry holds its text.

A dimension or time field named in agent_context that the dataset no
longer declares (renamed or removed in the Ossie file) is now refused with
the reference and the fix, instead of an uncaught StopIteration for a
dimension or a guessed raw column for the time field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jbonofre added a commit that referenced this pull request Nov 16, 2026
… audit (#711)

* docs(spec-changes): correct and complete the 0.3.0.dev0 history

Update the #577 and #591 rows, which later PRs superseded: #587 set the
default NULL placement in window ORDER BY, and #633 lets dataset-scoped
metrics reference source columns as source.column. State the #617
precedence of expression.sql as the MUST the spec makes it.

Add the breaking changes merged in this window (#397 root dialects and
vendors removed, #400 ontology uri renamed to iri, #486 name resolution),
together with #587, #633 and the Layer 3 interface (#653).

* fix(scripts): make the spec change audit see all of main

Drop --first-parent: on a branch that has merged main, it followed the
branch and skipped every main commit merged after the branch forked.
Resolve the default history file and the pathspecs from the repository
root, so running from a subdirectory no longer reports no candidates.
Read --since as midnight UTC, matching the dates in the history, instead
of the current local time on that date.

Strip GIT_* variables and the user's git config from the test
environment, so the tests cannot act on the developer's repository when
run from a git hook, and run them in Validation CI.
christianeu-db pushed a commit to apache/ossie-converters that referenced this pull request Nov 16, 2026
…203)

Stage 1 of #79 for ThoughtSpot: the reader takes a
portable expression from either location, preferring `expression.sql`. The
writer does not move.

apache/ossie#617 made `expression.sql` the top-level home of the portable
expression; `expression.dialects[]` still carries a tagged `OSSIE_SQL_2026`
entry, so a document may present either or both. A new helper,
`portable_expression_entries`, folds a usable `sql` in as the entry it already
is, so all four read sites see one shape instead of each learning the second
location.

A usable `sql` supersedes every other entry except THOUGHTSPOT. Narrowing that
to the portable dialects alone is not enough: two of the readers scan the entry
list for a bare column identifier across any dialect, so a foreign vendor entry
beside a `sql` field produced a wrong `db_column_name` -- and, where the
authoritative expression was an aggregate, a physical column with no formula
and no issue at all. Both are silent wrong output; both are now pinned.

A superseded sibling is therefore not a fallback. When `sql` is present and
this converter cannot translate it, the field or metric is reported and
dropped rather than quietly converted through an expression the document marks
as not authoritative. That is a behaviour change for a document carrying a
translatable tagged entry beside an untranslatable `sql`, and it is a declared
loss in place of a silent one.

Ordering `sql` ahead of a tagged ANSI_SQL entry follows #79 and the databricks
reference implementation (OssieConverterCommon.java), not the schema, which
makes `sql` authoritative only against an OSSIE_SQL_2026 entry. Honeydew #182
is not precedent for the vendor-native-first step: it has no vendor dialect.

Also pins, as a limit rather than a fix, that a dataset-scoped metric is read
by nothing today -- the converter has no dataset-scoped path, so such a metric
is dropped with no formula and no issue. That gap belongs to #30.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
jbonofre added a commit to apache/ossie-converters that referenced this pull request Nov 17, 2026
#79 stage 2) (#215)

* feat(thoughtspot): write the portable expression to expression.sql

Stage 2 of #79 for this converter, and the other half
of apache/ossie#617. #203 is stage 1: it taught the reader to accept a
top-level `expression.sql`. With that in place the writer can emit one.

`sql` is the specification's PRIMARY portable form, and either location may
stand alone, so a consumer reading `sql` alone -- which the spec invites --
saw nothing portable from this converter at all. Every portable expression
it produced lived only in `dialects[ANSI_SQL]`.

Additive, never a replacement. The ANSI_SQL entry stays exactly where it
was: PORTABLE_DIALECT is ANSI_SQL rather than OSSIE_SQL_2026 on the emit
side because a survey of this repository found omni and sigma drop a metric
carrying only OSSIE_SQL_2026 (#22), and moving the
expression into `sql` would reintroduce that loss. One string serves both --
apache/ossie#450 established the two dialects parse identically.

Nothing new is translated. An expression with no portable sibling still has
none and still carries TS-EXPR-THOUGHTSPOT-ONLY; `sql` copies a portable
form that exists, it does not invent one. The fixtures show the scale of
that: 37 `sql` lines added, nothing removed or changed.

The round trip is unaffected. THOUGHTSPOT still outranks `sql` on the way
back in -- `portable_expression_entries` returns [THOUGHTSPOT, sql] -- so
our own documents re-read exactly as before.

Both fixtures still validate against the upstream schema. Four mutations of
the writer were run; all four were killed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* docs(thoughtspot): describe the writer emitting expression.sql

The README still said the writer had not moved and that expressions are
written back as dialects[] only. Describe stage 2 of #79: a portable
expression is written to the top-level sql and kept as the tagged
ANSI_SQL entry beside the verbatim THOUGHTSPOT one.

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: JB Onofré <jb@nanthrax.net>
jbonofre pushed a commit to apache/ossie-converters that referenced this pull request Nov 21, 2026
* feat(atlan): add Atlan metric registry converter

Registry metric records <-> Apache Ossie, both ways, offline. Import folds filters into
every aggregate, binds parameters, splits whole-query formulas into one metric per output,
and carries what a talk-to-data agent needs in custom_extensions[ATLAN]; export rebuilds a
registry definition from one Ossie metric; write-back produces the versioned registry patch
an edit implies. Shapes Ossie cannot express are per-metric issues, not file refusals.

19 golden cases on a synthetic TPC-DS registry (tests/fixtures), validated against the
core-spec schema, apache/ossie's validator and the registry's metric kind schema.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* feat(atlan): review fixes: parked date windows, refusals for wrong-number shapes, public lockfile

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* feat(atlan): round-two review fixes, public lockfile, sqlglot>=28

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* feat(atlan): add dependabot entry for the atlan converter

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(atlan): address review: unqualified columns in joins, zero_denominator round trip, backticked names

- A raw-SQL query that joins tables and has an unqualified column is refused with the column
  names, instead of the column being assigned to the base table.
- COALESCE(expr, 0) around the whole expression is read back as aggregation.zero_denominator
  rather than copied into the registry formula, so forward -> write-back -> forward is stable.
- Table-name parts drop backticks as well as double quotes, so BigQuery and Databricks names
  give valid dataset names and table-qualified columns resolve.

Each comes with a test that fails on the previous code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(atlan): tighten the review fixes after verification

- zero_denominator: COALESCE(<expr>, 0) is read back as the setting only for a record whose
  zero_denominator is zero, and only with a numeric 0. A COALESCE the author wrote stays in the
  formula, and an already wrapped expression is not wrapped twice.
- Table names are parsed in one place, in the record's dialect: BigQuery's `proj.ds.tbl` in one
  pair of backticks is three parts, four-part names work, and a name that is not a plain table
  reference, does not parse, or uses quotes the dialect does not use is refused. The dataset
  source keeps quoted parts exactly as written and folds unquoted parts per dialect; quoted and
  unquoted spellings of one table match when a join is resolved. Dataset names are valid
  identifiers that do not read as keywords.
- When a record's SQL joins tables (a whole-query formula or a source.sql row set), a column with
  no table prefix is refused in the SQL (including ON clauses) and in the formula, filters,
  dimensions and timeframe_column; a required_join that names no join is refused. A dimension's
  filter_form puts a bare column on the dimension's own table. The structured-field convention
  is documented in registry-format.md; the README lists every refusal.
- New golden fixture bigquery_backticked_names; tests for each case above.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(atlan): register in the interop matrix

The interop matrix (#62) requires every converter project to be
registered, so this adds Atlan: a manifest entry with CLI import and
export, `atlan` as a file-shaped native format whose members are the
metric records of a registry export, a native fixture of ten synthetic
TPC-DS records, the interop CI path filter, and the README rows.

What the matrix needed from the converter:

- `export` with no `--metric` writes every metric as registry records
  (`{"artifacts": [...]}`), the shape `import` already reads. A metric
  the registry cannot express is a METRIC_NOT_CONVERTIBLE issue and the
  rest are still written. `--metric NAME` is unchanged.
- A record with no registry id imports as a metric not yet in the
  registry, so exported new metrics read back. Write-back refuses such a
  metric (NotWritable), since there is no record to patch.
- Dataset-scoped metrics (`datasets[].metrics`, apache/ossie#591) were
  ignored on export; they now export with their bare columns read as
  their own dataset's. A name two metrics share is refused.
- A document with no `metrics` is an Ossie document: export writes an
  empty registry export instead of refusing the file.

Also aligns the setup-python and setup-uv pins in the Atlan workflow
with the ones main uses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(atlan): read a dataset metric's own field before a metric of that name

A dataset-scoped metric names its dataset's fields unqualified, so a
field `amount` is that field even when a model metric is also called
`amount`; it was refused as "built from other metrics". Also counts
Atlan in the README converter totals (23) and writes Atlan's native
output with a .json suffix in the runner, matching checks.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(atlan): read top-level expression.sql and refuse stale agent_context refs

Since apache/ossie#617 an expression may carry only `sql` (OSSIE_SQL_2026),
and `sql` is authoritative over an OSSIE_SQL_2026 entry in `dialects`.
expression_text now reads `sql` first and refuses an expression with
neither; a dataset-scoped metric promoted to a model metric falls back to
OSSIE_SQL_2026 when no dialect entry holds its text.

A dimension or time field named in agent_context that the dataset no
longer declares (renamed or removed in the Ossie file) is now refused with
the reference and the fix, instead of an uncaught StopIteration for a
dimension or a guessed raw column for the time field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(atlan): target the Ossie 0.3.0.dev0 specification

ossie#691 moved the in-development version to 0.3.0.dev0 and the schema
rejects 0.2.0.dev0. The converter now writes 0.3.0.dev0, the golden fixtures
follow, and the golden validator test runs every check of ossie's
validate_document instead of a hand-picked subset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: shubhambatlan <217801236+shubhambatlan@users.noreply.github.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
jbonofre pushed a commit to zackm-solid/ossie-converters that referenced this pull request Nov 23, 2026
The spec now lets an expression carry its portable OSSIE_SQL_2026 form
as a top-level `sql`, alone or beside `dialects`, and makes it
authoritative over an OSSIE_SQL_2026 entry there. Export read only
`dialects`, so a valid sql-only expression raised "has no expression".
It is now read as the OSSIE_SQL_2026 form, keeping the existing order
(selected dialect, then ANSI_SQL, then OSSIE_SQL_2026); when it and an
OSSIE_SQL_2026 entry differ, the top-level `sql` wins with a warning.
Import keeps writing `dialects`, since a Solid formula is warehouse SQL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

3 participants