-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SQL tests for time spine metrics with sub-daily grain
- Loading branch information
1 parent
2bebb71
commit d00d9b2
Showing
11 changed files
with
3,062 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
602 changes: 602 additions & 0 deletions
602
...rendering.py/SqlQueryPlan/DuckDB/test_subdaily_cumulative_grain_to_date_metric__plan0.sql
Large diffs are not rendered by default.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
...py/SqlQueryPlan/DuckDB/test_subdaily_cumulative_grain_to_date_metric__plan0_optimized.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
-- Join Self Over Time Range | ||
-- Pass Only Elements: ['archived_users', 'metric_time__hour'] | ||
-- Aggregate Measures | ||
-- Compute Metrics via Expressions | ||
SELECT | ||
subq_10.ts AS metric_time__hour | ||
, SUM(subq_8.archived_users) AS subdaily_cumulative_grain_to_date_metric | ||
FROM ***************************.mf_time_spine_hour subq_10 | ||
INNER JOIN ( | ||
-- Read Elements From Semantic Model 'users_ds_source' | ||
-- Metric Time Dimension 'archived_at' | ||
SELECT | ||
DATE_TRUNC('hour', archived_at) AS metric_time__hour | ||
, 1 AS archived_users | ||
FROM ***************************.dim_users users_ds_source_src_28000 | ||
) subq_8 | ||
ON | ||
( | ||
subq_8.metric_time__hour <= subq_10.ts | ||
) AND ( | ||
subq_8.metric_time__hour >= DATE_TRUNC('hour', subq_10.ts) | ||
) | ||
GROUP BY | ||
subq_10.ts |
Oops, something went wrong.