You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reference implementation for rewriting Layer 2 and Layer 3 queries #707
A reference implementation that takes queries in these layers, and convert them to regular SQL is useful for multiple reasons, including i) More concrete specification compared to examples & tests ii) Can be used as a standalone library, for building an ossie engine.
A query.ossie.sql for each case in compliance/wide_table/cases that returns rows (a01 to a21). It holds the Layer 2 query of the case's Section 5 lowering. The 25 error cases have no Layer 2 query, so they get none.
A Layer 3 lowering that turns query.json and the model into that Layer 2 query, or into a Section 8 error.
Running the cases in .ost, once View expander #502 lands and ost can load the retail and stores fixtures.
I'm working on (2). One question before anyone starts (3): should it live in ost/ next to the expander, or in a separate library, as this issue suggests?
I wrote the Layer 2 queries of a few cases by hand and expanded them with the 502-expander branch (f91b5a5), then ran them on DuckDB. a01, a02, a07 and a08 return the expected rows. Two kinds of case need what the expander does not support yet:
a12 has dimensions from orders and customers and no metric. Its query joins two relations of a model without AGG(), and the expander stops with "view expander does not support measures through a join yet".
a16, a19, a20 and a21 use date_dim.year, whose expression is d_year. On a19 the expander stops with "view expander does not support field expressions yet: year".
With #769 merged, I'm starting on (3) and (4). The lowering will live in ost next to the expander, because its output is the expander's input. I plan two PRs:
The retail and stores fixtures, an ost function that runs a Layer 3 query through the lowering and the expander, and the cases that return rows as .ost scripts.
The 25 error cases as .ost scripts, each expecting its Section 8 code.
On main (83d39d6), 16 of the 21 query.ossie.sql files expand and return the rows of expected.txt. The other five still stop on the two gaps from my comment above (a12, and a16, a19, a20, a21). The first PR will list them as pending.
Activity
vigneshc commentedon Nov 8, 2026
@christianeu-db , created this for further discussions and tracking.
christianeu-db commentedon Nov 9, 2026
Thanks #502's expander should cover a reference impl for Layer 2. Will keep this item open to track Layer 3 tests / expanders
ekut commentedon Nov 17, 2026
@christianeu-db listed four next steps in the review of #716. For the Layer 3 part of this issue, I propose to finish them in three more PRs:
.osttable format, with the case notes incompliance/wide_table/cases/README.md: done in test(compliance): write wide table expected results as ost tables #741.query.ossie.sqlfor each case incompliance/wide_table/casesthat returns rows (a01toa21). It holds the Layer 2 query of the case's Section 5 lowering. The 25 error cases have no Layer 2 query, so they get none.query.jsonand the model into that Layer 2 query, or into a Section 8 error..ost, once View expander #502 lands andostcan load theretailandstoresfixtures.I'm working on (2). One question before anyone starts (3): should it live in
ost/next to the expander, or in a separate library, as this issue suggests?I wrote the Layer 2 queries of a few cases by hand and expanded them with the
502-expanderbranch (f91b5a5), then ran them on DuckDB.a01,a02,a07anda08return the expected rows. Two kinds of case need what the expander does not support yet:a12has dimensions fromordersandcustomersand no metric. Its query joins two relations of a model withoutAGG(), and the expander stops with "view expander does not support measures through a join yet".a16,a19,a20anda21usedate_dim.year, whose expression isd_year. Ona19the expander stops with "view expander does not support field expressions yet: year".christianeu-db commentedon Nov 19, 2026
@ekut fyi, #502 is currently in review in #769
ekut commentedon Nov 22, 2026
With #769 merged, I'm starting on (3) and (4). The lowering will live in
ostnext to the expander, because its output is the expander's input. I plan two PRs:retailandstoresfixtures, anostfunction that runs a Layer 3 query through the lowering and the expander, and the cases that return rows as.ostscripts..ostscripts, each expecting its Section 8 code.On
main(83d39d6), 16 of the 21query.ossie.sqlfiles expand and return the rows ofexpected.txt. The other five still stop on the two gaps from my comment above (a12, anda16,a19,a20,a21). The first PR will list them as pending.