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
Copy file name to clipboardExpand all lines: docs/native-fixtures.md
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,7 +79,8 @@ The suite currently covers:
79
79
- Parameter interpolation in query filters.
80
80
- Pre-aggregation routing shape and DuckDB execution against seeded rollup tables.
81
81
- Semantic SQL rewrite cases for single-model and relationship queries.
82
-
- Query-local table calculations on the Rust SQL compiler path, including Rust-only DuckDB result coverage.
82
+
- Query-local table calculations for the shared Python/Rust subset. Python applies these after fetching rows;
83
+
Rust compiles them into SQL window expressions.
83
84
- Native `.sql` definition files.
84
85
- Native SQL frontmatter model definitions.
85
86
- YAML `sql_metrics` and `sql_segments` blocks.
@@ -112,6 +113,15 @@ The default Rust runner loads every manifest fixture, asserts `expected/validati
112
113
113
114
The `adbc-exec` Rust runner executes every query with `expected_result` or `rust_expected_result` through DuckDB ADBC, using the fixture seed SQL and result columns from the manifest. Any Rust-only expected output must include `rust_only_reason`. It is enabled in CI after installing the DuckDB ADBC driver.
114
115
116
+
Table-calculation fixture contract:
117
+
118
+
- Shared table calculations may use `percent_of_total`, `percent_of_previous`, `running_total`, `rank`, `row_number`, or `moving_average`.
119
+
- Shared calculations should include deterministic query `order_by` when row order affects the result.
120
+
- Python evaluates shared calculations with `TableCalculationProcessor` after query execution.
121
+
- Rust evaluates shared calculations by compiling them into SQL expressions.
122
+
- Rust-only table calculation types (`dense_rank`, `difference`, `lead`, `lag`) must use `rust_expected_result` and `rust_only_reason`.
123
+
- Python-only post-query table calculation types (`percent_of_column_total`, `percentile`) stay out of shared native fixtures until Rust supports them.
124
+
115
125
## Adding Fixtures
116
126
117
127
Add the narrowest fixture that proves one semantic behavior. Avoid kitchen-sink fixtures unless the behavior itself is cross-feature interaction.
Copy file name to clipboardExpand all lines: docs/native-format.md
+46-1Lines changed: 46 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,20 @@ The native format has two source forms:
9
9
10
10
The native format is the runtime contract. External formats such as LookML, MetricFlow, Hex, Rill, Malloy, Omni, Superset, GoodData, Snowflake Cortex, ThoughtSpot, Holistics, Tableau, AtScale SML, BSL, and Yardstick should be converted into this format by Python importers before they are expected to run through the Rust native runtime.
11
11
12
+
## Rust Loader Scope
13
+
14
+
The Rust runtime and Rust CLI directory loader intentionally have a smaller direct
15
+
input surface than Python:
16
+
17
+
-`.yml` / `.yaml`: native Sidemantic YAML or Cube YAML.
18
+
-`.sql`: native Sidemantic SQL definition files.
19
+
20
+
They do not auto-detect LookML, MetricFlow/dbt manifests, Hex, Rill, Malloy,
AtScale SML, BSL, Yardstick, or other external source formats. Convert those
23
+
formats through the Python CLI/API first, then load the exported native YAML/SQL
24
+
with the Rust runtime.
25
+
12
26
## Versioning
13
27
14
28
Current native format version: `1`.
@@ -61,6 +75,18 @@ Top-level sections:
61
75
| `metrics` | No | Graph-level metrics. Rust assigns these to exactly one owning model when possible. |
62
76
| `parameters` | No | Graph-level parameters for templates and query-time substitution. |
63
77
78
+
Top-level metrics are graph-scoped in the Python runtime. The Rust runtime does not
79
+
store a separate graph-metric namespace at execution time; it assigns each top-level
80
+
metric to one owning model by resolving explicit model references, metric dependencies,
81
+
entity dimensions, or a single-model project fallback. If Rust cannot infer exactly
82
+
one owner, loading fails. Portable native files should therefore make top-level metric
83
+
dependencies explicit, for example `orders.total_revenue` rather than `total_revenue`
84
+
when multiple models define the same local metric name. Dotted top-level metric names
85
+
are allowed and are resolved by exact metric name before `model.metric` parsing.
86
+
87
+
Top-level parameters remain graph-scoped in both runtimes. Query APIs interpolate
88
+
parameter values before SQL compilation.
89
+
64
90
## Models
65
91
66
92
Models describe physical or logical query sources.
@@ -94,6 +120,12 @@ At least one of `table`, `sql`, or `source_uri` should be present unless the mod
94
120
| `pre_aggregations` | No | List of pre-aggregation definitions. |
95
121
| `default_time_dimension` | No | Time dimension to add by default when the query needs time grouping. |
96
122
| `default_grain` | No | Default time grain for the default time dimension. |
123
+
| `auto_dimensions` | No | Python auto-discovery flag. Rust accepts `false` for compatibility and rejects `true` because it does not perform schema discovery. |
124
+
125
+
Canonical CLI-authored files should use `metrics` and `sql`. The native loaders
126
+
also accept compatibility input aliases: model-level `measures` for `metrics`,
127
+
dimension/metric `expr` for `sql`, and metric `measure` for `sql`. Exports use
Copy file name to clipboardExpand all lines: docs/rust-runtime.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -105,4 +105,4 @@ cd sidemantic-rs && cargo test --test native_fixtures
105
105
106
106
CI runs these in the `Native Compatibility` job.
107
107
108
-
The shared fixture suite currently includes executable coverage for basic models, joins, fanout-safe symmetric aggregation, many-to-many joins, parameters in filters, embedded SQL definitions, SQL frontmatter definitions, default time dimensions, segments, derived/ratio metrics, and pre-aggregation routing. Table calculations have Rust-only DuckDB result coverage because Python does not accept `table_calculations` in the native query API yet. `source_uri` is covered as a validation-only load fixture and query compilation rejects it until a concrete table or SQL source is provided.
108
+
The shared fixture suite currently includes executable coverage for basic models, joins, fanout-safe symmetric aggregation, many-to-many joins, parameters in filters, embedded SQL definitions, SQL frontmatter definitions, default time dimensions, segments, derived/ratio metrics, table calculations, and pre-aggregation routing. `source_uri` is covered as a validation-only load fixture and query compilation rejects it until a concrete table or SQL source is provided.
0 commit comments