Execution equality
Comparing the text a compiler writes cannot see a collation that is ignored or a null that sorts the wrong way. Fixtures can therefore carry a seeded dataset and the rows a real engine must return, and the results are compared column by column and row by row. A known and accepted difference between engines is written down in the fixture.
T-1's second tier. Where artifact equality (T-1a) compares what a compiler writes, execution equality (T-1b) compares what the compiled query returns when a real engine runs it over a seeded table. It exists because a string comparison cannot see a collation that is silently ignored, a null that sorts the wrong way, or a window that one engine rejects. Its inputs are two files at a fixture's root, dataset.json and expectedRows.json, validated by fixtures/schemas/dataset.schema.json and fixtures/schemas/expected-rows.schema.json. This addendum is the only place the comparison rule is stated; the fixture README, the conformance-runner spec and the schemas point here.
XEQ-1. What a fixture carries. A fixture carries dataset.json and expectedRows.json together or neither. The seed belongs to the fixture: there are no cross-fixture seed references in v1, so one case can be read, changed and re-derived without looking at another. The engine loads the seed into the table named by the fixture's schema.json source (SQL-0), then runs the compiled query for that backend with the request's own startRow/endRow. The tier applies to every backend the fixture has an expected/<backend>.artifact.json for and the harness can reach, and every such backend is held to the same expectedRows.json unless XEQ-4 says otherwise. A fixture whose query returns no rows (a rejection) carries neither file. A writer-tier fixture's compiled query does return rows, so it may carry the pair beside its rowStream.json, which is a different file: a row stream is what an adapter yields after the query, a seed is what is stored before it.
XEQ-2. Value encodings. Seed rows and expected rows are keyed or aligned by logical colId, never by a physical name, and encode each cell by the field's declared GridSchema type:
| Type | JSON form |
|---|---|
int64 | a JSON integer; a fixture stays within ±2^53 so every language reads it back exactly |
double | a JSON number |
decimal | a JSON string carrying the exact digits ("12.50"), the same reason a Mongo artifact spells one {"$numberDecimal": …} |
boolean | true / false |
string | a JSON string, stored and compared exactly as written (no trimming, no case change) |
date | "YYYY-MM-DD", a local date with no zone (SEM-4) |
datetime | "YYYY-MM-DDTHH:MM:SS[.fff]Z", an absolute UTC instant (SEM-4), at most millisecond precision: MongoDB's Date and Search's date keep no more, so a finer seed would be truncated differently per engine and could move across a range bound. A SQLite seed is written with all three fractional digits, ...:00.000Z for a whole second (SEM-4's host obligation) |
| absent value | an explicit JSON null; never an omitted key |
Every field the fixture's schema.json declares appears in every seed row, so a reader can tell a null from an oversight. A seed row may carry a why; an authored fixture always does. Two further rules keep the oracle well-formed:
- the seed's stableKey column is unique and non-null in every row: SEM-6's tiebreaker makes a result order total only over such a key, and XEQ-3 depends on that;
- a fixture that has an
oracleartifact avoids''in any seeded column, or declares an XEQ-4rowsdivergence fororacle: Oracle stores the empty string as NULL (SQL-7), so a seeded''comes back as null there and, in a sorted column, moves from first among the strings to NULLS LAST.
XEQ-3. The comparison rule. The result's column list is compared exactly, then the rows in order, then each cell by its type. The column list is the logical one, whatever an engine physically returns: an ordinary row query's columns are the schema's fields in declaration order (GRP-3's leaf rule), a grouped level's are GRP-3's group column then each aggregation's valueCols entry id (not its compiled key), and a BM-3 values query's is the one schema field named by setValuesRequest.colId, and an export's is its own list. A harness maps each engine's rows onto it before comparing (physical to logical, dropping _id, hit metadata and any column the compiled query never projected), so a harness that keeps MongoDB's _id and one that drops it cannot both conform.
- order is part of the contract: with a unique, non-null stableKey (XEQ-2), SEM-6's tiebreaker makes the result order total, so two correct engines cannot legitimately differ in row order. The one accepted difference is AGG-5's composite null bucket on Search, which a fixture declares under XEQ-4;
int64,boolean,dateandstringare compared exactly (strings by code point, with no collation, no case folding and no normalization: the point of the tier is to see the engine's own);decimalis compared as a number, so"1.50"equals"1.5"(an engine's scale is not semantics);doubleis compared with a relative tolerance of 1e-9,|a − b| ≤ 1e-9 · max(|a|, |b|), and exactly when either side is 0; the one exception is anavgaggregate column, compared as a double with a relative tolerance of 1e-6 (same formula, same exactness against 0), because an engine's average carries its own scale and rounding (SQL Server returnsdecimal(38,6), so its average of10.00,10.00,10.01is10.003333where an engine keeping more digits returns10.0033333…);datetimeis compared as an instant, so…:00Zequals…:00.000Z;nullequals onlynull: an empty string is not a null (it is a value on every engine except Oracle, where XEQ-2's seed rule applies) and a missing cell is a failure.
Aggregate columns are typed by the aggregation, not by the field. On a grouped level (rowGroupCols outnumber groupKeys) a column named by a valueCols entry is an aggregate, and takes its type from the function: count is int64; sum, min and max take the aggregated field's type; avg is always compared as a double under the tolerance above, whatever the field's type, because engines differ in the scale of an average (Postgres AVG(numeric) keeps about sixteen fractional digits, SQL Server decimal(38,6), Search returns a double), and under the 1e-6 tolerance above, not the 1e-9 of a plain double field. A grouped level's aggregate column in expectedRows.json is named by the valueCols entry's id; a compiled alias such as <field>_<func> (AGG-2) is physical, and a harness maps it onto that id before comparing. A decimal sum, min or max keeps the exact-decimal rule against another decimal; a Search double metric is compared against a decimal under the double tolerance. The id may equal the aggregated field's own name (amount summed with id amount); the compiled alias (amount_sum) still differs and is what the harness maps onto the id. A drill-down leaf (rowGroupCols equal to groupKeys) sends valueCols too but projects plain fields, so none of this applies to it. An export (a request carrying exportFormat, EXP-1) discards group state (EXP-1(a)), so it is never a grouped level: its valueCols entries are not aggregates and its columns are plain fields or the export's own list (page-export/010, 011, 024). A column that is neither a schema field nor a valueCols id of a grouped level is a mistake in the fixture, not an unchecked cell.
XEQ-4. Accepted divergence. When a real cross-engine difference is known and accepted, the fixture says so in expectedRows.json's allowedDivergence array rather than silently passing or silently failing. One entry per backend: the backend (the expected/<backend> stem), an optional engine (opensearch or elasticsearch, valid only with backend search, because that one artifact (OQ-7) runs on both engines and one can differ alone; an entry without it covers both, and the two forms are not mixed), a mandatory reason naming the rule or engine fact behind it, and an outcome: rows (the backend returns a different result, given in the entry's own expected) or error (the backend refuses the query; the harness asserts that it does). A backend with an entry is held to that entry and only that entry; a backend without one must match the fixture's main result. An error entry is asserted on purpose: a fix that makes the error disappear is a change someone should notice and delete the entry for, not a pass nobody sees.