Skip to content

Commit

Permalink
Update DuckDB snapshots + check query SQL
Browse files Browse the repository at this point in the history
  • Loading branch information
courtneyholcomb committed Nov 21, 2024
1 parent dfbb7a7 commit 34f7aa9
Show file tree
Hide file tree
Showing 7 changed files with 779 additions and 686 deletions.
2 changes: 1 addition & 1 deletion tests_metricflow/integration/test_cases/itest_metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1705,7 +1705,6 @@ integration_test:
SELECT
ds AS metric_time__day
FROM {{ source_schema }}.mf_time_spine
WHERE {{ render_time_constraint('ds', '2019-12-19', '2020-01-02') }}
) subq_3
INNER JOIN (
SELECT
Expand All @@ -1716,6 +1715,7 @@ integration_test:
ON {{ render_date_sub("subq_3", "metric_time__day", 5, TimeGranularity.DAY) }} = subq_2.metric_time__day
GROUP BY subq_3.metric_time__day
) outer_subq
WHERE {{ render_time_constraint('metric_time__day', '2019-12-19', '2020-01-02') }}
---
integration_test:
name: cumulative_time_offset_metric_with_time_constraint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ FROM (
SELECT
subq_6.ds AS metric_time__day
FROM ***************************.mf_time_spine subq_6
WHERE subq_6.ds BETWEEN '2019-12-19' AND '2020-01-02'
) subq_5
INNER JOIN (
-- Join Self Over Time Range
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,9 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
subq_17.metric_time__day AS metric_time__day
subq_18.ds AS metric_time__day
, COUNT(DISTINCT subq_16.bookers) AS every_2_days_bookers_2_days_ago
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
FROM ***************************.mf_time_spine subq_18
WHERE ds BETWEEN '2019-12-19' AND '2020-01-02'
) subq_17
FROM ***************************.mf_time_spine subq_18
INNER JOIN (
-- Join Self Over Time Range
SELECT
Expand All @@ -38,8 +32,8 @@ FROM (
)
) subq_16
ON
subq_17.metric_time__day - INTERVAL 2 day = subq_16.metric_time__day
WHERE subq_17.metric_time__day BETWEEN '2019-12-19' AND '2020-01-02'
subq_18.ds - INTERVAL 2 day = subq_16.metric_time__day
WHERE subq_18.ds BETWEEN '2019-12-19' AND '2020-01-02'
GROUP BY
subq_17.metric_time__day
subq_18.ds
) subq_23

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@ SELECT
, 2 * bookings_offset_once AS bookings_offset_twice
FROM (
-- Join to Time Spine Dataset
-- Constrain Time Range to [2020-01-12T00:00:00, 2020-01-13T00:00:00]
SELECT
subq_21.metric_time__day AS metric_time__day
, subq_20.bookings_offset_once AS bookings_offset_once
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
FROM ***************************.mf_time_spine subq_22
WHERE ds BETWEEN '2020-01-12' AND '2020-01-13'
) subq_21
subq_23.ds AS metric_time__day
, subq_21.bookings_offset_once AS bookings_offset_once
FROM ***************************.mf_time_spine subq_23
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
Expand All @@ -29,23 +24,24 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
subq_15.ds AS metric_time__day
, SUM(subq_13.bookings) AS bookings
FROM ***************************.mf_time_spine subq_15
subq_16.ds AS metric_time__day
, SUM(subq_14.bookings) AS bookings
FROM ***************************.mf_time_spine subq_16
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
FROM ***************************.fct_bookings bookings_source_src_28000
) subq_13
) subq_14
ON
subq_15.ds - INTERVAL 5 day = subq_13.metric_time__day
subq_16.ds - INTERVAL 5 day = subq_14.metric_time__day
GROUP BY
subq_15.ds
) subq_19
) subq_20
subq_16.ds
) subq_20
) subq_21
ON
subq_21.metric_time__day - INTERVAL 2 day = subq_20.metric_time__day
) subq_23
subq_23.ds - INTERVAL 2 day = subq_21.metric_time__day
WHERE subq_23.ds BETWEEN '2020-01-12' AND '2020-01-13'
) subq_25
Loading

0 comments on commit 34f7aa9

Please sign in to comment.