Initial Foundational Semantics Spec - #246
Conversation
4fba0e0 to
4ebfd2c
Compare
…e fixes Documentation: - Add compliance/ARCHITECTURE.md (spec<->impl<->suite contract, harness runtime + adapter flow diagrams, test anatomy, conformance model). - Rewrite compliance/README.md as the install/run entry point; refresh the harness and foundation READMEs. Tooling: - Make compliance/ a single uv workspace (pyproject.toml + uv.lock, members harness + foundation, dev group for pytest) so `uv sync` installs everything and `uv run` works from anywhere. Ignore *.egg-info/. Spec alignment (point at core-spec/foundational_semantics.md, per #246): - Repoint every proposals/foundation/Proposed_OSI_Semantics.md and foundation-v0.1 reference to core-spec/foundational_semantics.md and core-spec/expression_language.md across SPEC.md, decisions.yaml, proposals.yaml, conformance.yaml, DATA_TESTS.md, metadata.yaml, proposals_check.py, and test_registry_yaml.py. - Remap anchors to #246's structure: deferred features -> section 3, determinism (D-014) -> sections 5.1/6.10.2; error codes -> Appendix A (decisions are inline, no Appendix B/C). - Fix DATA_TESTS format drift (gold_rows.json -> gold.sql). Harness: - Implement decisions_coverage.md report (write_decisions_coverage in reporter.py, wired into run_suite) so every run surfaces D-NNN coverage gaps. Add test_reporter_coverage.py. Note conformance.yaml levels are declarative for now. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…e fixes Documentation: - Add compliance/ARCHITECTURE.md (spec<->impl<->suite contract, harness runtime + adapter flow diagrams, test anatomy, conformance model). - Rewrite compliance/README.md as the install/run entry point; refresh the harness and foundation READMEs. Tooling: - Make compliance/ a single uv workspace (pyproject.toml + uv.lock, members harness + foundation, dev group for pytest) so `uv sync` installs everything and `uv run` works from anywhere. Ignore *.egg-info/. Spec alignment (point at core-spec/foundational_semantics.md, per #246): - Repoint every proposals/foundation/Proposed_OSI_Semantics.md and foundation-v0.1 reference to core-spec/foundational_semantics.md and core-spec/expression_language.md across SPEC.md, decisions.yaml, proposals.yaml, conformance.yaml, DATA_TESTS.md, metadata.yaml, proposals_check.py, and test_registry_yaml.py. - Remap anchors to #246's structure: deferred features -> section 3, determinism (D-014) -> sections 5.1/6.10.2; error codes -> Appendix A (decisions are inline, no Appendix B/C). - Fix DATA_TESTS format drift (gold_rows.json -> gold.sql). Harness: - Implement decisions_coverage.md report (write_decisions_coverage in reporter.py, wired into run_suite) so every run surfaces D-NNN coverage gaps. Add test_reporter_coverage.py. Note conformance.yaml levels are declarative for now. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…e fixes Documentation: - Add compliance/ARCHITECTURE.md (spec<->impl<->suite contract, harness runtime + adapter flow diagrams, test anatomy, conformance model). - Rewrite compliance/README.md as the install/run entry point; refresh the harness and foundation READMEs. Tooling: - Make compliance/ a single uv workspace (pyproject.toml + uv.lock, members harness + foundation, dev group for pytest) so `uv sync` installs everything and `uv run` works from anywhere. Ignore *.egg-info/. Spec alignment (point at core-spec/foundational_semantics.md, per #246): - Repoint every proposals/foundation/Proposed_OSI_Semantics.md and foundation-v0.1 reference to core-spec/foundational_semantics.md and core-spec/expression_language.md across SPEC.md, decisions.yaml, proposals.yaml, conformance.yaml, DATA_TESTS.md, metadata.yaml, proposals_check.py, and test_registry_yaml.py. - Remap anchors to #246's structure: deferred features -> section 3, determinism (D-014) -> sections 5.1/6.10.2; error codes -> Appendix A (decisions are inline, no Appendix B/C). - Fix DATA_TESTS format drift (gold_rows.json -> gold.sql). Harness: - Implement decisions_coverage.md report (write_decisions_coverage in reporter.py, wired into run_suite) so every run surfaces D-NNN coverage gaps. Add test_reporter_coverage.py. Note conformance.yaml levels are declarative for now. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ning Extracts the closed algebra — the compiler's correctness core — from the foundation reference implementation (#125) into the ossie package, with the foundation types it needs (common/{identifiers,sql_expr,types}, errors), a hypothesis property/law + closure test suite, and the enforcement kit (mypy --strict, import-linter closure contract, file-size audit, mutmut config). Ships an AGENTS.md alongside the algebra with the directory-scoped closure rules (pointing to ARCHITECTURE.md). Reviewed against the foundational semantics spec (#246) and folded the fixes in: - The algebra's internal fan-out signal is E4001_EXPLOSION_UNSAFE, not the spec-reserved engine-wide opt-out E3011; the planner maps it to the user-facing code (E_UNSAFE_REAGGREGATION / E_FAN_OUT_IN_SCALAR_QUERY). - Holistic re-aggregation is blocked only over a *discharged* aggregate (new Column.is_discharged_aggregate), so a single-step holistic over a plain N:1 enriched dimension stays allowed per D-020. - ARCHITECTURE.md documents the algebra as necessary-not-sufficient for Semantic 4 (the planner owns chasm/stitch decomposition). - Doc references repointed to core-spec/foundational_semantics.md (Appendix A; #246 section numbering). 31 tests green; mypy --strict clean; import-linter contract kept. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Will — read the full document. Strong support, both for the content and for the foundational-first approach: As discussed in #46, full support from an SAP perspective. The five user-visible semantics — especially Semantic 5 (typed error, never a plausible-but-wrong number) and Semantic 1's NULL-bucketing of unmatched fact rows — address the query-time family of what we saw in the field. The NULL determinism work (§5.1 ordering defaults, §6.11 empty/NULL aggregate behaviour, NULL-safe stitch merges) pins down the places where observed engines quietly disagree. Adding composite keys as first-class citizens in relationships ( The worst losses we measured were not query-time — they were transport-time: an observed ontology platform (Fabric) accepted parts of our semantic model with a success response and silently discarded them. We only caught it by re-reading what was stored. The Foundation guarantees no silently wrong answer; nothing yet guarantees no silently dropped model construct. A conformance rule in the same spirit — an implementation MUST either represent a construct, reject it with a typed error, or explicitly report it as unsupported (never accept-and-drop) — would extend Semantic 5's philosophy to interchange itself, and would have caught every silent loss in our audit. The working draft's reference to a conformance suite (§11.1) looks like this rule's natural home. If useful, I'm happy to share the anonymized loss table as test material. In SAP, there are 2 validations
Two editorial catches: (1) the body references §9, §10, §11, §12 (SQL-interface proposal, deferred-features registry, extension flags + conformance suite, vendor comparison incl. "§12.A divergence note") — none of which exist in the committed file or, as far as I can see, in the working draft either. As committed, readers hit dangling anchors; either trimming the references or landing stub sections would tighten it. (2) The working draft's §4.6.1 explicitly pins quoted-identifier case-sensitivity ( One clarifying question: the ontology layer's Happy to turn any of the above into concrete test fixtures — that's the form feedback is most useful in. |
|
A short follow-up to the transport-time point above (Im the same Mario), because its failure mode just surfaced inside this repo — worth pinning while it's fresh. #311 (filed and fixed by @mattfaltyn) caught the dbt converter silently corrupting composite keys: primary_key: [tenant_id, order_id] goes in, the key group is flattened into independent columns, and the round-trip comes back as primary_key: [order_id] — accepted, no error, no warning. The fix in #312 lands, in the author's own words, on "an explicit ValueError" replacing "plausible but incorrect" output, that is precisely the second arm of the conformance rule proposed above: represent, reject with a typed error, or report unsupported; never accept-and-drop. Happy to contribute a composite-key fixture pair as a first transport-conformance test, so the next case is caught by CI rather than by whoever happens to be looking. |
|
To follow up from the 8/12 semantics working group, the core concern we raised in this thread is how this interface will be consumed by BI tools. Many BI tools implement a high-level interface for taking a multi-table model and compiling SQL. The challenge these tools will face is layering their query semantics on top of a similar high-level query interface through SQL. We've prepared some example Tableau queries in this linked section. We'll also create a PR containing some of these patterns and solicit other vendors for examples. Even when querying a simple single-table model, Tableau can issue multiple subqueries, self joins and unaggregated references to measures / metrics. The other core challenge is around correctness when querying these objects through SQL, which may look like a table but act quite differently. Concretely, tables have the property that adding grouping columns or aggregate expressions does not change which underlying rows contribute possible dimension values. For example, SELECT d1, d2, d3 FROM T all return the same distinct values for d1. As shown in this Top N example, Tableau depends on this property to optimize queries. Specifically, it can combine two subqueries together that compute two different measures by the same dimension because it relies on the fact that these dimension domains will be the same. That is not the case for the proposed foundational semantics. Because each measure anchors on its own fact and join path, the dimension values in a result depend on which measures are present: a measure contributes only the values its fact reaches (§6.6, LEFT-from-fact) plus a null bucket for its unmatched rows (Semantic 1), and combining measures from different facts unions their group sets (Semantic 3). So two queries differing only in their measures can return different domains for the same dimension. In the 8/12 meeting, Will described adding a fixed grain for an Ossie model. However, that idea should be fleshed out formally. As we understood this proposal, the idea is that all joins would join out from a specific anchor table. That preserves domain consistency but also requires careful integration with the rest of the proposal. For example,
Of course, we are advocating for general SQL interoperability by extending tables, so we are happy to collaborate on exploring this direction. Some of the decision points we’d like to see clarity on are:
|
|
Yes. The idea of the Foundational Semantics is that they are something we
get out that describes the current Ossie mode, that we can build on later.
Many of the things proposed are things we all want, e.g. a SQL interface
for querying, metrics on tables, etc. They were just prioritized behind
adding semantics for the model we currently have.
The big stickiness is how we want to deal with the "wide table"-ness. This
is the root of the semantic troubles. Can we query an Ossie model as a
single table (with heuristic joins under the cover) or does it act more
like a schema and each tool joins on its own?
Justin put out a doc a while ago that resonated with me (although, I can't
find a public version). It proposes 3 layers:
* Layer 3: Wide table Interface
* Layer 2: SQL Measures
* Layer 1: Common expression language
Some of the core of this discussion is that in my mind, we want to build
out all 3. However, the original Ossie spec started with a description of
Layer 3. This current discussion, I believe is about what a proper Layer 2
would look like.
My current approach was to get semantics that define what Layer 3 looks
like, so we at least have defined behaviour. As you mentioned, I believe
we can add better behaviour through the concept of a root grain.
…On Wed, Aug 12, 2026 at 2:58 PM Chris Eubank ***@***.***> wrote:
*christianeu-db* left a comment (apache/ossie#246)
<#246 (comment)>
To follow up from the 8/12 semantics working group, the core concern we
raised in this thread
<https://lists.apache.org/thread/mqlbbb4ndhb0qo9sf2yn60fb9tlzv59t> is how
this interface will be consumed by BI tools. Many BI tools implement a
high-level interface for taking a multi-table model and compiling SQL. The
challenge these tools will face is layering their query semantics on top of
a similar high-level query interface through SQL.
We've prepared some example Tableau queries in this linked section
<https://docs.google.com/document/d/1uKc3x9NlvV9O9UPdvlnCTDxsc-XWsQrxb0ylG45H-IQ/edit?tab=t.22qc6753kxb3#heading=h.ousekbpu23pw>.
We'll also create a PR containing some of these patterns and solicit other
vendors for examples. Even when querying a simple single-table model,
Tableau can issue multiple subqueries, self joins and unaggregated
references to measures / metrics.
The other core challenge is around correctness when querying these objects
through SQL, which may look like a table but act quite differently.
Concretely, tables have the property that adding grouping columns or
aggregate expressions does not change which underlying rows contribute
possible dimension values. For example,
SELECT d1, d2, d3 FROM T
SELECT d1 FROM T GROUP BY ALL
SELECT d1, d2 FROM T GROUP BY ALL
SELECT d1, SUM(m1) FROM T GROUP BY ALL
SELECT d1, SUM(m2), MIN(m3) FROM T GROUP BY ALL
all return the same distinct values for d1.
As shown in this Top N example
<https://docs.google.com/document/d/1uKc3x9NlvV9O9UPdvlnCTDxsc-XWsQrxb0ylG45H-IQ/edit?tab=t.22qc6753kxb3#heading=h.ousekbpu23pw>,
Tableau depends on this property to optimize queries. Specifically, it can
combine two subqueries together that compute two different measures by the
same dimension because it relies on the fact that these dimension domains
will be the same.
That is not the case for the proposed foundational semantics. Because each
measure anchors on its own fact and join path, the dimension values in a
result depend on which measures are present: a measure contributes only the
values its fact reaches (§6.6, LEFT-from-fact) plus a null bucket for its
unmatched rows (Semantic 1), and combining measures from different facts
unions their group sets (Semantic 3). So two queries differing only in
their measures can return different domains for the same dimension.
In the 8/12 meeting, Will described adding a fixed grain for an Ossie
model. However, that idea should be fleshed out formally. As we understood
this proposal, the idea is that all joins would join out from a specific
anchor table. That preserves domain consistency but also requires careful
integration with the rest of the proposal. For example,
1. Let's start with the model of Actors-Appearances-Movies. The
current semantics say no row input for a measure should be dropped. Fixing
an anchor of actors and left-joining outward means a measure on movies is
computed only over movies that have a matching appearance - so movies with
no matching appearances are dropped. This behavior directly violates the
spec's Semantic 1 (no row input for a measure should be dropped).
2. The Ossie model allows for edges which could introduce path
ambiguity if some combinations of dimensions / measures are used together.
If grain/domain is fixed, path ambiguity can't be resolved lazily per query
(some queries would just fail); it has to be resolved at model-definition
time.
Of course, we are advocating for general SQL interoperability by extending
tables
<https://docs.google.com/document/d/1uKc3x9NlvV9O9UPdvlnCTDxsc-XWsQrxb0ylG45H-IQ/edit?tab=t.0#heading=h.5vtm2vjqu4mp>,
so we are happy to collaborate on exploring this direction.
Some of the decision points we’d like to see clarity on are:
1. Are Ossie models designed to be safely consumable by BI tools that
generate their own SQL? How can we prove this correctness?
2. From the perspective of SQL consumers, does an Ossie model expose
the semantics of a single relational object with a stable domain, or of a
multi-table model whose effective joins / domains depend on the query -
which likely contradicts general SQL integration?
—
Reply to this email directly, view it on GitHub
<#246?email_source=notifications&email_token=AAQXKZHTDYNWDPBGNWUSU535JTSARA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKMRXGMZDKOBRGI42M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-5273258129>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQXKZBI2QNEWOCKSXVKPGT5JTSARAVCNFSNUABGKJSXA33TNF2G64TZHMYTAOJZGM4DEMJTG45US43TOVSTWNBZGQ4TKOJRHE2THILWAI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Summary
Related Issues
This is MD version of the foundational semantics spec. It started in Google Docs: Proposed Foundational Semantics.
This follows from the discussions in the expression language slack group, and mail
NOTE: There were two comments in the original doc around join direction behaviour (to not lose fact table rows) and null safe joins. These have been addressed in this version, by being explicit about when null safe joins are required and being explicit about joining from the fact tables out.
Checklist
Specification
core-spec/and follow the existing structureOntology
ontology/are consistent with spec changesConverters
converters/is updated to reflect spec or ontology changesValidation
validation/are updated if the spec changedDocumentation
docs/is updated to reflect any user-facing changesCONTRIBUTING.mdis updated if the contribution process changedExamples
examples/are added or updated for any new spec constructs or converter supportTests
pytest/ CI green)Compliance