From bd92e307b06483f07213f2930e554b873b703423 Mon Sep 17 00:00:00 2001 From: Luca Martial Date: Sat, 16 May 2026 09:34:38 -0700 Subject: [PATCH] docs: polish safe sql comparison --- .../concepts/semantic-layer-internals.mdx | 64 +++++++++++++------ 1 file changed, 43 insertions(+), 21 deletions(-) diff --git a/docs-site/content/docs/concepts/semantic-layer-internals.mdx b/docs-site/content/docs/concepts/semantic-layer-internals.mdx index 720321ec..aec0ccfa 100644 --- a/docs-site/content/docs/concepts/semantic-layer-internals.mdx +++ b/docs-site/content/docs/concepts/semantic-layer-internals.mdx @@ -323,27 +323,49 @@ and picks a simple or aggregate-locality SQL shape. className="not-prose my-8 overflow-hidden rounded-lg border border-fd-border bg-fd-card shadow-sm" aria-label="Fan-out safe execution shape" > -
-
-

- {"Unsafe shape"} -

-
+  
+

+ {"Fan-out handling"} +

+

+ {"The same question planned before and after KTX preserves the measure grain."} +

+
+
+
+
+

+ {"Unsafe shape"} +

+

+ {"Join first, aggregate later"} +

+
+
 {`orders
-  join order_items
-  join customers
-group by customer_segment
-sum(orders.amount)`}
+  -> join order_items
+  -> join customers
+
+group by
+  customer_segment
+
+measure
+  sum(orders.amount)`}
       
-

- {"The order measure is exposed to line-item fan-out before aggregation."} -

+
+ {"Order-level revenue is exposed to line-item fan-out before aggregation."} +
-
-

- {"KTX shape"} -

-
+    
+
+

+ {"KTX shape"} +

+

+ {"Aggregate locally, then join"} +

+
+
 {`orders_agg as (
   select customer_id, sum(amount) revenue
   from orders
@@ -353,9 +375,9 @@ select customers.segment, sum(revenue)
 from orders_agg
 join customers`}
       
-

- {"KTX pre-aggregates fact measures at their own grain before joining dimensions."} -

+
+ {"The measure is pre-aggregated at order grain before dimensions are joined."} +