-
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.
- Loading branch information
1 parent
441d852
commit 0d34d74
Showing
12 changed files
with
108 additions
and
132 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
16 changes: 7 additions & 9 deletions
16
...yPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__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 |
---|---|---|
@@ -1,32 +1,30 @@ | ||
-- Join Self Over Time Range | ||
-- Pass Only Elements: ['txn_revenue', 'metric_time__month'] | ||
-- Pass Only Elements: ['txn_revenue', 'metric_time__day'] | ||
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00] | ||
-- Aggregate Measures | ||
-- Compute Metrics via Expressions | ||
SELECT | ||
subq_14.metric_time__month AS metric_time__month | ||
subq_14.metric_time__day AS metric_time__day | ||
, SUM(subq_13.txn_revenue) AS revenue_all_time | ||
FROM ( | ||
-- Time Spine | ||
SELECT | ||
DATETIME_TRUNC(ds, month) AS metric_time__month | ||
ds AS metric_time__day | ||
FROM ***************************.mf_time_spine subq_15 | ||
WHERE ds BETWEEN '2020-01-01' AND '2020-01-01' | ||
GROUP BY | ||
metric_time__month | ||
) subq_14 | ||
INNER JOIN ( | ||
-- Read Elements From Semantic Model 'revenue' | ||
-- Metric Time Dimension 'ds' | ||
-- Constrain Time Range to [2000-01-01T00:00:00, 2020-01-01T00:00:00] | ||
SELECT | ||
DATETIME_TRUNC(created_at, month) AS metric_time__month | ||
DATETIME_TRUNC(created_at, day) AS metric_time__day | ||
, revenue AS txn_revenue | ||
FROM ***************************.fct_revenue revenue_src_28000 | ||
WHERE DATETIME_TRUNC(created_at, day) BETWEEN '2000-01-01' AND '2020-01-01' | ||
) subq_13 | ||
ON | ||
(subq_13.metric_time__month <= subq_14.metric_time__month) | ||
WHERE subq_14.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01' | ||
(subq_13.metric_time__day <= subq_14.metric_time__day) | ||
WHERE subq_14.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01' | ||
GROUP BY | ||
metric_time__month | ||
metric_time__day |
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
16 changes: 7 additions & 9 deletions
16
...lan/Databricks/test_cumulative_metric_no_window_with_time_constraint__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 |
---|---|---|
@@ -1,32 +1,30 @@ | ||
-- Join Self Over Time Range | ||
-- Pass Only Elements: ['txn_revenue', 'metric_time__month'] | ||
-- Pass Only Elements: ['txn_revenue', 'metric_time__day'] | ||
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00] | ||
-- Aggregate Measures | ||
-- Compute Metrics via Expressions | ||
SELECT | ||
subq_14.metric_time__month AS metric_time__month | ||
subq_14.metric_time__day AS metric_time__day | ||
, SUM(subq_13.txn_revenue) AS revenue_all_time | ||
FROM ( | ||
-- Time Spine | ||
SELECT | ||
DATE_TRUNC('month', ds) AS metric_time__month | ||
ds AS metric_time__day | ||
FROM ***************************.mf_time_spine subq_15 | ||
WHERE ds BETWEEN '2020-01-01' AND '2020-01-01' | ||
GROUP BY | ||
DATE_TRUNC('month', ds) | ||
) subq_14 | ||
INNER JOIN ( | ||
-- Read Elements From Semantic Model 'revenue' | ||
-- Metric Time Dimension 'ds' | ||
-- Constrain Time Range to [2000-01-01T00:00:00, 2020-01-01T00:00:00] | ||
SELECT | ||
DATE_TRUNC('month', created_at) AS metric_time__month | ||
DATE_TRUNC('day', created_at) AS metric_time__day | ||
, revenue AS txn_revenue | ||
FROM ***************************.fct_revenue revenue_src_28000 | ||
WHERE DATE_TRUNC('day', created_at) BETWEEN '2000-01-01' AND '2020-01-01' | ||
) subq_13 | ||
ON | ||
(subq_13.metric_time__month <= subq_14.metric_time__month) | ||
WHERE subq_14.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01' | ||
(subq_13.metric_time__day <= subq_14.metric_time__day) | ||
WHERE subq_14.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01' | ||
GROUP BY | ||
subq_14.metric_time__month | ||
subq_14.metric_time__day |
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
16 changes: 7 additions & 9 deletions
16
...yPlan/Postgres/test_cumulative_metric_no_window_with_time_constraint__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 |
---|---|---|
@@ -1,32 +1,30 @@ | ||
-- Join Self Over Time Range | ||
-- Pass Only Elements: ['txn_revenue', 'metric_time__month'] | ||
-- Pass Only Elements: ['txn_revenue', 'metric_time__day'] | ||
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00] | ||
-- Aggregate Measures | ||
-- Compute Metrics via Expressions | ||
SELECT | ||
subq_14.metric_time__month AS metric_time__month | ||
subq_14.metric_time__day AS metric_time__day | ||
, SUM(subq_13.txn_revenue) AS revenue_all_time | ||
FROM ( | ||
-- Time Spine | ||
SELECT | ||
DATE_TRUNC('month', ds) AS metric_time__month | ||
ds AS metric_time__day | ||
FROM ***************************.mf_time_spine subq_15 | ||
WHERE ds BETWEEN '2020-01-01' AND '2020-01-01' | ||
GROUP BY | ||
DATE_TRUNC('month', ds) | ||
) subq_14 | ||
INNER JOIN ( | ||
-- Read Elements From Semantic Model 'revenue' | ||
-- Metric Time Dimension 'ds' | ||
-- Constrain Time Range to [2000-01-01T00:00:00, 2020-01-01T00:00:00] | ||
SELECT | ||
DATE_TRUNC('month', created_at) AS metric_time__month | ||
DATE_TRUNC('day', created_at) AS metric_time__day | ||
, revenue AS txn_revenue | ||
FROM ***************************.fct_revenue revenue_src_28000 | ||
WHERE DATE_TRUNC('day', created_at) BETWEEN '2000-01-01' AND '2020-01-01' | ||
) subq_13 | ||
ON | ||
(subq_13.metric_time__month <= subq_14.metric_time__month) | ||
WHERE subq_14.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01' | ||
(subq_13.metric_time__day <= subq_14.metric_time__day) | ||
WHERE subq_14.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01' | ||
GROUP BY | ||
subq_14.metric_time__month | ||
subq_14.metric_time__day |
Oops, something went wrong.