Skip to content

test(compliance): write wide table expected results as ost tables - #741

Merged
christianeu-db merged 1 commit into
apache:mainfrom
ekut:wide-table-ost-format
Nov 16, 2026
Merged

christianeu-db merged 1 commit into
apache:mainfrom
ekut:wide-table-ost-format

Conversation

@ekut

@ekut ekut commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #716: the first of the next steps in the review. The expected results of the wide table cases move from JSON to the table format of ost (#667), and the notes on the cases move to one README, compliance/wide_table/cases/README.md.

In each of the 46 folders of compliance/wide_table/cases/:

  • expected.json is removed.
  • expected.txt has a comment line that names the fixture, and the expected result as ost prints it: a table for the 21 cases that return rows, and the line > error: <code> for the 25 cases that raise an error.
  • query.json is unchanged.

cases/README.md has the title, question, behavior, and spec sections of each case, grouped by fixture. The wording is the same, except that COUNT(*) is in backticks: in e14, Markdown would read the two asterisks of one paragraph as emphasis.

For example, a05_groups_from_orders/expected.json was:

{
  "title": "Groups come from the metric's dataset",
  "question": "What is the order amount by customer region?",
  "behavior": "One branch from orders. NORTH has no orders, so it is not a group.",
  "spec": ["5.4", "6.1"],
  "columns": ["region", "total_revenue"],
  "rows": [
    ["EAST", 350],
    ["WEST", 300]
  ]
}

It is now expected.txt, below the license header:

# fixture: retail

+--------+---------------+
| region | total_revenue |
+--------+---------------+
| EAST   |           350 |
| WEST   |           300 |
+--------+---------------+

and a section of cases/README.md, under retail:

### a05_groups_from_orders

- Title: Groups come from the metric's dataset
- Question: What is the order amount by customer region?
- Behavior: One branch from orders. NORTH has no orders, so it is not a group.
- Spec: 5.4, 6.1

compliance/wide_table/README.md describes the new files. Results are compared by value, as before: the rules of compliance/query/README.md apply, and the table is the notation for the values.

In the review of #716, @jbonofre noted that keeping expected.json is fine since the binding is JSON. The query stays in JSON. The expected result changes its notation, as @christianeu-db asked in the same PR.

Open questions:

  1. Comparison. ost compares the text of a cell exactly, so 350.00 does not match 350. The rules of compliance/query/README.md compare values, and types are not compared. I kept those rules. When the cases move to .ost, should they keep them, or should each case fix the type of its columns? A table also does not say whether a number is exact or approximate. The README takes that from the model, where only revenue_per_customer returns an approximate numeric.
  2. Errors. ost compares an error by its message. The line > error: E_NO_PATH matches only if the function that submits a Layer 3 query raises the error itself, with the code as its whole message: ost never matches a database error. Is that the form you have in mind? The line also has no place for the optional fields that @jbonofre suggested in the review of feat(compliance): add Layer 3 wide table query cases #716, which a harness could check: the dimension or the filter, and the metric. If the cases should carry them, where should they go?

Checks:

  • ost produced the table text: for each of the 21 row cases I ran ost --update over a VALUES query built from the rows of the old expected.json.
  • A script compared each expected.txt and each section of cases/README.md with the old expected.json at da73e0e. The columns, rows, error codes, fixtures, spec sections, and texts are equal in the 46 cases.
  • dev/check-license passes. Each new file has the ASF header.

cc @christianeu-db @jbonofre

Each case's expected.json becomes expected.txt: a comment line that names
the fixture, and the result in the output format of the ost runner (a
table, or "> error: <code>"). The title, question, behavior and spec
sections of every case move to cases/README.md. query.json is unchanged.
The README of the suite describes the new files. Results are compared by
value, as before.

@christianeu-db christianeu-db left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks @ekut - this will make the migration to .ost much easier

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants