-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
807696c
commit 3c0367b
Showing
7 changed files
with
1,281 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
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
617 changes: 617 additions & 0 deletions
617
...ity.py/SqlPlan/DuckDB/test_multiple_time_spines_in_query_for_cumulative_metric__plan0.sql
Large diffs are not rendered by default.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
...Plan/DuckDB/test_multiple_time_spines_in_query_for_cumulative_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,35 @@ | ||
test_name: test_multiple_time_spines_in_query_for_cumulative_metric | ||
test_filename: test_custom_granularity.py | ||
sql_engine: DuckDB | ||
--- | ||
-- Join Self Over Time Range | ||
-- Join to Custom Granularity Dataset | ||
-- Pass Only Elements: ['archived_users', 'metric_time__martian_day', 'metric_time__hour'] | ||
-- Aggregate Measures | ||
-- Compute Metrics via Expressions | ||
SELECT | ||
subq_12.martian_day AS metric_time__martian_day | ||
, subq_11.ts AS metric_time__hour | ||
, SUM(subq_9.archived_users) AS subdaily_cumulative_window_metric | ||
FROM ***************************.mf_time_spine_hour subq_11 | ||
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_9 | ||
ON | ||
( | ||
subq_9.metric_time__hour <= subq_11.ts | ||
) AND ( | ||
subq_9.metric_time__hour > subq_11.ts - INTERVAL 3 hour | ||
) | ||
LEFT OUTER JOIN | ||
***************************.mf_time_spine subq_12 | ||
ON | ||
DATE_TRUNC('day', subq_11.ts) = subq_12.ds | ||
GROUP BY | ||
subq_12.martian_day | ||
, subq_11.ts |
Oops, something went wrong.