The Python bridge sends a versioned JSON snapshot of its existing semantic graph to the Rust compiler. This replaces the native-YAML conversion previously used by the compile, validate, and rewrite paths. Native YAML/SQL and external adapters remain authoring inputs. The Python and Rust compilers still have separate graph implementations; this bridge does not yet consolidate them into one compiler.
The Python producer snapshots existing definitions without constructing new
models, parsing SQL, assigning graph metrics to models, or invoking source
adapters. Rust validates the versioned input before projecting supported
definitions into its graph. The received JSON snapshot remains available alongside
that projection in SemanticInput.source. It is not the original authoring file
and does not preserve source syntax, comments, or formatting.
The JSON envelope contains:
| Field | Meaning |
|---|---|
version |
Integer contract version; currently 1. |
input_dialect |
SQL expression context for the input definitions. |
models |
Model definitions, including dimensions, metrics, relationships and restrictions. |
metrics |
Graph-scoped metrics, retained separately from model metrics. |
metric_owners |
Only explicitly declared model ownership for graph-addressable metrics. |
parameters |
Parameter definitions. |
table_calculations, explores, saved_queries |
Retained named catalogs; unused entries do not block query compilation. |
metadata, import_warnings |
Source and descriptive information. |
required_capabilities |
Declared special requirements, independently checked against the definitions by the receiver. |
Definition fields use the existing Python objects' default values when omitted.
Nondefault values are copied, including fields excluded from ordinary authoring
exports: logical data types, declared temporal roles, and relationship edge
identities. A model's primary_key is always either null or an ordered list of
columns. Unknown uniqueness never becomes an implicit id column.
Metric SQL is copied verbatim into the source snapshot. sql_is_complete distinguishes a complete
expression from aggregation shorthand. Source dialect metadata is preserved;
unsupported expression contexts must be rejected rather than reinterpreted.
Descriptions and display metadata may have no execution effect. Their original values remain in the received graph snapshot. Mandatory restrictions and unknown semantic fields cannot be silently discarded during projection.
The versioned boundary provides Rust compile, reference-validation, and
semantic-SQL rewrite entrypoints. Declared input dialects are normalized through
polyglot into DuckDB syntax before semantic binding; the source envelope remains
unchanged. Structured query query_dialect and rewrite context sql_dialect
can select request syntax independently of graph syntax and output dialect.
Graph expression metadata prefers ossie_target_dialect when present, otherwise
ossie_expression_dialect. Output dialect selection belongs to Rust SQL
generation. Generated target SQL is not evidence that its warehouse has passed
live execution tests.
Selected segment templates render with request parameters and defaults before normalization in their authored dialect. Jinja conditions see raw values while emitted values retain declared parameter types and SQL string escaping, including outputs embedded in quoted literals. Segment definitions retain their trusted physical-subquery scope. Unselected templates remain inert, and rendering changes only the request execution graph, preserving the original source snapshot.
The structured compiler supports basic aggregations, filtered measures, declared keyed joins, complete aggregate expressions, and graph metric binding. It also supports:
- Independent source aggregation for cross-model ratios and derived metrics, including source filters, aggregate filters, and grouped results. Child outputs are normalized before recombination, so dimensions and measures from different owners can share a basename without changing their grouping or population. Public collisions use owner-qualified names; qualified ordering and filters retain their semantic binding. Truly duplicate child output names remain an explicit unsupported shape.
- Separate relationship role instances, nested and scoped role names, inactive edge exclusion, and rejection of ambiguous join paths. Explicit adapter join kinds retain their direction and row-preservation behavior.
- Model access policies, SQL-literal-safe user attributes, row policies, invariant filters, and opt-in field visibility. Restrictions reach the source CTEs of aggregate and temporal child queries.
- Running, rolling, and grain-to-date aggregates over period outputs, plus
calendar comparisons and offset ratios. Windows partition by the selected
non-time dimensions. Named comparisons use calendar intervals even without
a declared grain;
prior_periodwithout a resolved grain retains previous-row semantics. Summing period-level distinct counts is not a distinct count over the combined underlying rows. - Numeric and string null defaults on simple, derived and ratio results. Defaults apply to metric dependencies after aggregation, including absent source leaves after cross-source recombination; they do not create policy-excluded groups. Cumulative and time-comparison defaults apply after the window or comparison calculation, including missing prior periods and zero prior denominators for ratios/percent changes. They do not fill the underlying period values or create missing periods. Existing window frames, partitions, ordering and policies remain in effect. Offset-ratio defaults apply after division by the prior-period denominator, preserving NULLIF protection for zero denominators. Source-local snapshot defaults apply after snapshot selection and the final aggregation; they do not replace null inputs before count or average. Source-local cohort defaults likewise wrap only the outer result, preserving inner values and HAVING. Conversion and retention retain Python's existing behavior: their null-default metadata is accepted but does not change the generated result. Filled cumulative metrics reject comparison offsets; filled time comparisons reject cumulative windows and grain-to-date controls rather than silently ignoring them.
- Cumulative
window_expressionfields retain the authored function expression and frame, including expressions over multiple period outputs. The input is a grouped period metric value; it is not a physical source column.window_ordernames a selected period output column or an unambiguous selected dimension name, resolving its explicit or default grain, and defaults to the selected time dimension. Windows retain selected non-time partitions.window_frameis parsed as a SQL window frame; the default is unbounded preceding rows through the current row. Frames also apply to cumulative metrics with an aggregate and base-metric reference. Combining a frame withwindoworgrain_to_dateis rejected. Authored expressions and frames are parsed into the window AST; result coverage includestest_window_output_parity.py.
Configured rollups reach the Rust graph through this boundary. Routing supports source-local sum/count/min/max and filtered states, plus AVG reconstructed from stored sum and a compatible count. Count compatibility checks the actual nullable input and metric filters, not the count's name. COUNT(*) is a valid denominator only when the AVG input is provably non-null, such as COALESCE(amount, 0). An incompatible denominator falls back to the raw AVG in both engines. Native COUNT(DISTINCT input) rollups retain scalar state only at the exact stored dimensions and time grain. Omitted dimensions, coarser buckets, lambda freshness, join regrouping, and derived dependencies use raw planning for distinct counts. Derived and ratio metrics reconstruct their source-local aggregate dependencies; metric predicates become HAVING over those reconstructed states. Empty count populations return zero, while nullable sums and averages remain null.
The model that owns the selected metrics anchors an ordinary query in both engines: dimension models are LEFT JOINed onto it, metric rows without a matching dimension row form a NULL group, and dimension members without metric rows are not groups. An Explore's base model replaces that anchor; see Which rows a joined query keeps.
One-hop many-to-one dimension queries can route through a rollup carrying every
join key, including composite keys. The rollup stands in for the metric model and
is the preserved side, so stored groups whose join key is NULL or unmatched stay
in a NULL dimension group, exactly as in raw planning. Dimension expressions of a
joined model apply only to rows that have a matching dimension row: an expression
such as COALESCE(name, 'unknown') leaves unmatched metric rows in the NULL group
on both routes and in both engines. An explicit anchor on
another model, explicit join kinds, colliding output aliases, uncovered join keys, multi-hop or fanout joins and row filters on
this join route use ordinary source planning. Compatible stored dimensions and
time grains retain their existing routing checks: bucketed timestamps cannot serve
finer grains or untruncated timestamps, and week buckets cannot serve months.
Cross-source aggregate child queries retain raw-source planning.
Lambda rollups preserve their rollups round-trip metadata and support
union_with_source_data. When build_range_end, a time dimension and a grain are
present, the batch leg includes buckets strictly before the boundary bucket and
the live leg rebuilds that entire bucket and later rows using the same additive
state materializer. This avoids double-counting a mid-bucket boundary and permits
coarser query grains. Without a boundary, routing reads only the stored rollup.
Active row policies and invariant filters always bypass rollups, including when routing was requested. Access and visibility checks still run before routing. Python materialization preserves invariants; the legacy Rust materialization helper continues to reject models with invariant filters instead of discarding them. Rust materialization supports filtered sum/count/min/max and AVG sum states, with separate count inputs defining the denominator. Custom SQL, partitioned builds, non-lambda partial build ranges and non-additive distribution states remain unsupported by that materializer.
Filtered complete measures are supported when their SQL AST is exactly
SUM(input), AVG(input), COUNT(input), COUNT(DISTINCT input),
MIN(input), or MAX(input) over local physical row inputs, or exactly
COUNT(*), COUNT(1), or COUNT(NULL). Row inputs may use addition, subtraction,
multiplication, modulo, CASE, and COALESCE, with local columns, literals,
comparisons, boolean conditions, null checks, ranges, and literal lists. The whole
input is filtered after evaluation, so excluded rows cannot contribute a CASE
or COALESCE fallback. Each new expression must reference a local physical column.
These aggregates can be declared inside a model or as graph metrics with an explicit
model owner. The source declaration remains unchanged; its executable copy
uses the ordinary per-measure filtered aggregate path. Local qualified columns
are normalized without changing string literals, and each filter is parenthesized
before conjunction. Filters use physical values even when a semantic dimension
shares the column name. Independent measures retain independent populations.
Average counts each qualifying non-null source row in its denominator, while
distinct count collapses repeated qualifying values and excludes nulls. These
states use the keyed fanout-safe aggregate planner. Filtered COUNT(*) and COUNT(1) count
qualifying source rows even when their values are null; it returns zero for an
empty population, a group without matches, or an absent cross-source count leaf.
Keyed joins count each qualifying source key once per selected group. COUNT(NULL)
returns zero while still enforcing the owner's mandatory restrictions; it does
not create groups excluded by those restrictions. Explicitly owned graph aggregates
use the same source population and retain their public output names.
For fanout SUM and AVG,
that planner selects one joined row per requested group and source primary key
before aggregating the original filtered value. It preserves floating-point
values and returns null for groups containing no qualifying non-null values.
Complete expressions outside that simple lowering retain their authored aggregate
formula and local physical inputs. The entity aggregate planner handles aggregate
combinations and statistical aggregates after source-key deduplication, applying
each measure's filters to its inputs. Filtered opaque constants without an input,
foreign-model inputs or predicates, unresolved templates, and invalid row-filter
expressions remain rejected. Unowned graph measures remain unsupported on this path.
Row-count execution coverage targets DuckDB and PostgreSQL. TSQL count widths
require separate qualification, so Python TSQL retains its existing
complete-expression path for COUNT and COUNT_BIG. TSQL filtered complete row
counts are not qualified by this change.
Approximate distinct aggregates use target-dialect function generation in direct, complete, nested, cumulative, snapshot and cohort expressions. Target-SQL translation tests preserve filters and source populations; they do not establish function availability on every warehouse. Remaining capability gates include many-to-many paths without explicit keyed junctions, genuinely duplicate child output aliases, invalid complete-expression inputs, and special-route population combinations that cannot preserve their source grain. Dedicated routes are described below and covered by their conformance suites.
Deserialization alone is not evidence of executable support.
Structured queries accept aliases (semantic reference to output name),
timezone, and with_totals. Aliases rename finalized result columns without
changing internal aggregate/window dependencies; semantic references and custom
output names both work for selected-column ordering. Selected result calculations
consume the renamed columns and retain alias-aware ordering after pagination.
A query timezone localizes UTC-stored timestamps before time-dimension truncation and bypasses UTC-bucketed materialized rollups. Localization follows the Python dialect contract for DuckDB, PostgreSQL, Snowflake, BigQuery, Spark, Databricks, and ClickHouse; unsupported output dialects reject localization. Filters and relative-date comparisons remain in their original time domain. The database validates timezone existence; the compiler validates safe timezone characters.
with_totals adds only the grand-total row, with _is_total distinguishing
it from real NULL dimension groups. Distinct counts and averages are recomputed
from source rows. Snapshot state selection and one-to-one multi-model calculations
retain their aggregate semantics. Totals without dimensions keep the ordinary
aggregate row, without a marker. Explicit limit/offset and ungrouped totals are
invalid; configured row caps are bypassed. Window-function metrics and
materialized pre-aggregation plans retain the Python
unsupported-combination boundary (query.totals.window or
query.totals.preaggregation). Single-source fanout totals deduplicate source
keys across all groups, rather than summing one copy per group. This also repairs
the Python distinct-state path, where a key appearing in two groups previously
inflated the total and changed its average.
These options do not change the engine default or weaken mandatory policies.
Structured query compilation, query-reference validation, and SQL rewriting
preserve unused table-calculation, Explore, and saved-query declarations without
executing them. Catalog entries must be objects with unique non-empty names;
their execution fields remain in the source snapshot. Whole-graph
SemanticInput::from_json validation still rejects unsupported catalogs.
The Python layer resolves saved queries and Explores before dispatch, preserving
visibility checks, selection and expression allowlists, mandatory filters,
parameters, defaults, row limits, and saved-query immutability. The resolved
consumption_base_model query field anchors ordinary Rust queries to the Explore
model even when only related-model fields are selected. Base and intermediate
model policies remain mandatory; related-only metrics and dimensions preserve
the authorized base population. Same-owner derived and ratio metrics use this
ordinary route. Independent aggregates, cumulative/time-comparison metrics and
snapshot routes also retain the anchor when discovering and filtering their
source populations. Foreign anchors on source-local event routes remain rejected
where that route cannot retain the anchored population.
Raw runtime requests that select explore or saved_query fail with typed
capability errors. Resolve those named consumption contracts through the Python
CLI or API; raw consumption_base_model supplies the population anchor, not named
contract authorization. Structured compile and validation requests accept an
ordered table_calculations name list, applying supported calculations to the
final selected result. See Selecting result calculations
for the expression, ordering, dependency and dialect contract. SQL rewrite
context rejects active named contracts and calculation selections. Catalog
presence alone never activates a contract. Model policies and invariant filters
remain mandatory.
Model-owned retention metrics support one source, with entity,
cohort_event, optional activity_event, and day/week/month periods. The first
qualifying event determines each entity's cohort. Activity is distinct per entity
and period; entities without returning activity remain in the cohort denominator.
Only observed activity periods are emitted, through the inclusive periods
bound (default 28). NULL entities and cohorts without a non-NULL event date do
not produce retention rows.
Query filters, metric filters, model invariants, and rendered row policies scope
both cohort and activity populations before either is calculated. The model's
default time dimension is preferred, otherwise its first time dimension is used.
Entity and time dimensions may map to physical source expressions. The fixed
outputs are cohort_date, days_since/weeks_since/months_since, active_users,
cohort_size, and retention_pct. Ordering and pagination apply to these outputs.
Selected result calculations can reference these finalized output columns, after
ordering and pagination, using the calculation contract described above.
Selected dimensions, graph-level or wrapped retention metrics, combinations with
other metrics, joined populations, aggregate predicates, window/subquery source
expressions and ungrouped queries remain
explicitly unsupported. Result acceptance is in
tests/semantic_conformance/test_retention_parity.py; enabling this path requires
the freshly built Rust extension to pass those cases, not only SQL compilation.
Output date differences follow the selected dialect, including BigQuery and
Snowflake endpoint/unit ordering. Warehouse execution needs its own qualification.
The existing YAML-based Rust utility entrypoints remain for compatibility. They are not an automatic fallback for the new compiler boundary and do not establish version-1 conformance for other host integrations.
For CLI semantic SQL, scoped SELECT ... FROM metrics queries with column
projections and aliases use the structured compiler, including cross-model
calculations, role dimensions and temporal metrics. The wrapper preserves the
requested output columns, ordering by projected fields, and pagination.
Caller attributes and opt-in visibility reach the same Rust policy planner as
structured queries. Access gates, row filters, invariants, and relationship-role
populations therefore also apply to supported scoped rewrites. Policy-bearing
SQL can nest those semantic leaves inside derived-table SELECTs and
nonrecursive CTEs. Every leaf, including unused CTE bodies, runs policy
preparation independently. Outer projections, DISTINCT, WHERE, GROUP BY,
HAVING, ORDER BY and pagination operate on the secured results. CTE column aliases
and nested shadowing are retained; user CTE bindings are renamed internally so they cannot
capture physical reads introduced by the compiler.
The scoped binder also handles explicit semantic joins, scalar/ad-hoc aggregate expressions, nested scalar and predicate queries, and set operations. CTE bindings and physical subquery scope remain separate from semantic field resolution. Yardstick measure and context expressions use their own lowering and expose compiler warnings through the diagnostics entrypoint. Unsupported source shapes and invalid bindings fail explicitly; security failures never trigger fallback.
CLI query and rewrite accept --user-attrs-file attributes.json containing a
JSON object and --enforce-visibility. These apply equally to execution,
query --dry-run, and SQL-only rewriting. Attribute files supply local caller
context; missing required attributes fail closed. Secured CLI requests bypass
pre-aggregations.
Conformance tests cover binding, nested policies and Yardstick behavior. These implementation paths do not establish full semantic-SQL parity without native result acceptance.
pythonuses the Python path.- Strict
rusteither executes the supported path or reports unavailable or unsupported requirements. auto, or explicitly permitted fallback, may select Python for a known unsupported requirement or unavailable versioned backend.
Malformed definitions, invalid references, and unexpected compiler failures
remain errors. They do not trigger speculative execution through another
engine. last_engine_selection records the selected engine and fallback reason
on the Python layer and rewriter. CLI fallback diagnostics go to stderr so SQL
and data stdout remain usable in pipelines.
tests/semantic_conformance/ loads actual native, Cube, and Ossie source fixtures into
synthetic DuckDB data and compares result columns and rows against independently
specified expectations. Unsafe or unsupported cases assert errors explicitly.
Rust tests require an installed extension; skipped Rust parameters do not count
as acceptance.
test_rollup_routing.py additionally creates materialized tables through the Python
and Rust helpers and compares real raw/routed execution against independent expected
rows. Poisoned unscoped rollups verify mandatory restriction bypass. These are
synthetic fixtures, not production workload or performance qualification.
tests/core/test_semantic_handoff.py checks inert snapshots and typed errors.
Rust's semantic_input tests check decoding, keys, scope, dialects and rejection
without relying on Python preprocessing.
Native Python installations now default to Rust with a matching runtime package; Pyodide retains Python. This does not retire the Python compiler or claim that WASM, the DuckDB extension, and the Python binding already expose identical capabilities. Each host needs corresponding acceptance evidence before its default or implementation ownership changes.
The generated WASM module exposes wasm_compile_with_semantic_input,
wasm_validate_with_semantic_input, wasm_rewrite_with_semantic_input, and
wasm_rewrite_with_semantic_input_context. Arguments are the same JSON strings
as the Python boundary; compilation returns SQL and failures throw a message.
Validation returns a JSON array of reference errors and does not authorize a
query. Caller attributes and visibility enforcement belong in the structured
query or rewrite context. The context-free rewrite does not bypass mandatory
policies.
CI executes the generated Node module and runs its SQL in DuckDB against an independently expected tenant-filtered population. This qualifies that host boundary for the tested subset, not browser packaging, DuckDB-extension host parity, or every semantic feature. WASM uses its host stack directly; it does not spawn the native semantic compiler worker thread.
Direct simple measures from one model can declare non_additive_dimension,
non_additive_window (min or max, default max), and optional
non_additive_window_groupings. The compiler selects the first or last snapshot
independently for each measure before aggregation. Snapshot values use the declared
dimension expression and grain; a day-grain timestamp selects every tied row on
the selected day. Omit that grain to select by the timestamp itself. Additive siblings retain all
rows. Without explicit groupings, selected query dimensions partition snapshot
selection; with explicit groupings, those fields and any selected coarse bucket
of the snapshot dimension partition it. Grouping by the raw snapshot dimension
needs no masking. Row restrictions apply before snapshot selection.
Derived and ratio wrappers over source-local snapshot leaves are supported. Fanout, multiple metric owners, aggregate predicates, colliding output aliases, ungrouped output, and rollup routing remain gated for this snapshot path. Null defaults apply only to the final aggregate after snapshot selection; null source inputs and additive sibling populations are preserved. This does not add raw-row cumulative semantics: cumulative references still operate on period outputs.
Source-local two-event conversion metrics (base_event, conversion_event,
entity, conversion_window) use the source-local Rust path. Conversion
counts distinct base entities with a target event inside the inclusive interval,
and divides by distinct base entities. Empty denominators return null. Grouping
attributes are attributed to the base event. Query filters, metric filters,
invariants, and caller policies constrain both event populations.
Entity, event and time dimensions may map to source expressions, and output identifiers retain quoting. The two-event path follows Python's last-declared time-dimension selection; the multi-step path uses its default/first time dimension. Joined populations, graph-scoped conversion metrics and calculated wrappers retain route-specific restrictions.
Direct model conversion metrics with two or more steps predicates use the
existing sequential funnel algorithm through the versioned boundary. Each
step finds the earliest qualifying event at or after the previous step's timestamp;
equal timestamps qualify. There is no conversion-window option for this form.
Selected grouping values belong to the first step and remain attached when later
events have different values. The first event is chosen per entity and selected
group, so an entity entering multiple groups belongs to each group's population.
Each group advances from its own first-step timestamp; the same later event can
qualify for multiple groups. Group counts therefore need not sum to the ungrouped
distinct count. Repeated events within a group do not multiply entity counts.
Outputs are selected dimensions, total_entities, each step_N_count, and the
metric name containing the final step count. The denominator includes only
distinct non-null first-step entities. A first-step entity with a null timestamp
can enter the denominator but cannot advance. Empty ungrouped populations return
zero counts. Ordering and pagination use these output columns.
Entity and time dimensions can map to row-local source expressions. Step predicates
refer to physical source columns; query and metric filters resolve declared dimensions.
All steps read the same policy-, invariant-, query-, and metric-filtered population.
The strict wrapper validates expressions and projects internal source columns before
calling the existing sequential generator. Graph-scoped metrics, mixed metrics,
joined populations, aggregate/window/subquery source expressions, colliding output
names (including dimensions named entity or step_N_ts) and rollup routing
remain gated. Null-default metadata retains Python's inert behavior.
The versioned bridge can generate PostgreSQL output for policy-bearing structured
queries (query.dialect = "postgres") and scoped semantic SQL rewrites
(rewrite context output_dialect = "postgres"; Python bridge keyword
output_dialect="postgres"). Input expressions and semantic SQL can declare
their source dialect independently. This does not change CLI engine defaults.
Access checks, typed caller attributes, row filters, invariants,
and opt-in visibility use the same policy preparation as DuckDB output.
The Rust CI job executes both output paths against a PostgreSQL 16 service using
its newly built Python extension wheel. The synthetic acceptance population
checks tenant and invariant exclusions, quoted/injection-shaped values, numeric,
boolean and null attributes, access denial, and visibility. Local runs without
SQLCTX_TEST_POSTGRES_DSN skip this host test; a configured job fails if the
service, driver, extension or expected rows are unavailable. PostgreSQL parity
is not qualified until that execution job passes. Other policy output dialects
use polyglot target generation. The conformance corpus checks DuckDB, PostgreSQL,
BigQuery, Snowflake, MySQL, Spark and TSQL output through a test-only translation
back to DuckDB; this does not qualify live warehouse execution.
PostgreSQL policy predicates emit target SQL before structured CTE assembly.
The rewrite path preserves its DuckDB intermediate and emits PostgreSQL only
from the final AST. year(date) policies explicitly lower to extract(year from date) and have a PostgreSQL row-result test. Date-difference predicates
remain unsupported: PostgreSQL elapsed-duration lowering does not preserve
DuckDB calendar-boundary counting for timestamps. Raw SQL nodes and unresolved
generic function nodes are also rejected for PostgreSQL policy output.
Public PostgreSQL layers keep graph definitions in the version-1 DuckDB input
contract while selecting PostgreSQL output. At the Python bridge, PostgreSQL
request SQL and structured filter/order expressions are normalized explicitly
to the compiler's input syntax. This conversion preserves quoted identifiers,
escaped strings and resolved null ordering; it does not bind semantic references
or rewrite graph definitions. Multiple statements and trailing scalar clauses
are rejected. Other declared request dialects pass to Rust for normalization,
and graph-expression dialect metadata is normalized in an executable copy.
The PostgreSQL CI corpus exercises SemanticLayer.compile,
query, sql, and QueryRewriter with a real PostgreSQL adapter and Rust runtime.
Named many-to-many relationships use a separate junction SQL instance for each
role, even when roles share the same physical junction table. They require an
explicit through model, through_foreign_key and related_foreign_key, and
known endpoint primary keys with matching arities. Composite key arrays are
accepted for junction matching, including ungrouped queries. Fanout aggregation
uses source-key deduplication, including composite measure keys on the entity
aggregate path.
Junction policies are applied to each role instance using the canonical
junction declaration. Measures retain their source-key grain across duplicate
junction rows. Inactive relationships remain excluded.
Direct model cohort metrics and graph metrics with an explicit metric_owners
entry can aggregate source rows per entity, apply having
to declared inner result columns, and aggregate the surviving groups. Query and
entity dimensions are carried through both levels, including explicit time
buckets. Outer count counts inner groups (including a qualifying null-entity
group); count_distinct without SQL counts non-null entities. Outer expressions
bind inner aliases, not physical source columns. Filters and mandatory policies
apply before the inner aggregation, with each predicate parenthesized.
This subset requires row-local scalar source expressions. Subqueries, windows, and aggregates hidden in source dimensions, inner SQL or row filters are rejected. Graph cohorts require their declared source owner; entity or output column names do not infer ownership. The declared owner also determines the mandatory restrictions applied to the source population. Joined populations, unowned graph cohorts and calculated wrappers remain gated. HAVING and outer expressions must reference available inner columns; other aggregate contexts are not silently inferred.
The WASM SQL parser has a host-specific admission limit of 16 nested parenthesis/bracket/brace/CASE constructs, 32 operators per expression chain, 16 set operations per parser input, and 48 combined live nesting/operator ancestors. Flat projections and independent clauses do not share an operator budget; long unary chains do. These are conservative fixed-host-stack limits, not limits on native compilation or source-file bytes. Dialect tokenization keeps strings, quoted identifiers, and comments out of structural nesting counts. Excess inputs return a SQL parse error before recursive parsing; generated intermediate SQL is subject to the same limits. Native hosts retain the existing larger worker stack.