Skip to content

Commit

Permalink
Update DuckDB snapshots
Browse files Browse the repository at this point in the history
These snapshot changes primarily show changes from the bug fix mentioned in the last commit. The optimized snapshots show the actual behavior change. There are some columns that may have a change that looks confusing, because they are now selected from the parent when previously they were selected from the time spine. This is only true for columns that do not get used anywhere else (nor are they selected at the top level of the query), so they do not impact the output. I would assume they should be pruned out by the optimizer, but that is a separate issue.
  • Loading branch information
courtneyholcomb committed Nov 20, 2024
1 parent af2375c commit 81e54f2
Show file tree
Hide file tree
Showing 35 changed files with 448 additions and 448 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,34 @@ sql_engine: DuckDB
---
-- Re-aggregate Metric via Group By
SELECT
subq_11.metric_time__week
, subq_11.booking__ds__month
subq_11.booking__ds__month
, subq_11.metric_time__week
, subq_11.every_two_days_bookers_fill_nulls_with_0
FROM (
-- Window Function for Metric Re-aggregation
SELECT
subq_10.metric_time__week
, subq_10.booking__ds__month
subq_10.booking__ds__month
, subq_10.metric_time__week
, FIRST_VALUE(subq_10.every_two_days_bookers_fill_nulls_with_0) OVER (
PARTITION BY
subq_10.metric_time__week
, subq_10.booking__ds__month
subq_10.booking__ds__month
, subq_10.metric_time__week
ORDER BY subq_10.metric_time__day
ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
) AS every_two_days_bookers_fill_nulls_with_0
FROM (
-- Compute Metrics via Expressions
SELECT
subq_9.metric_time__day
subq_9.booking__ds__month
, subq_9.metric_time__day
, subq_9.metric_time__week
, subq_9.booking__ds__month
, COALESCE(subq_9.bookers, 0) AS every_two_days_bookers_fill_nulls_with_0
FROM (
-- Join to Time Spine Dataset
SELECT
subq_7.metric_time__day AS metric_time__day
DATE_TRUNC('month', subq_7.metric_time__day) AS booking__ds__month
, subq_7.metric_time__day AS metric_time__day
, DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week
, subq_6.booking__ds__month AS booking__ds__month
, subq_6.bookers AS bookers
FROM (
-- Time Spine
Expand Down Expand Up @@ -380,6 +380,6 @@ FROM (
) subq_10
) subq_11
GROUP BY
subq_11.metric_time__week
, subq_11.booking__ds__month
subq_11.booking__ds__month
, subq_11.metric_time__week
, subq_11.every_two_days_bookers_fill_nulls_with_0
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@ sql_engine: DuckDB
---
-- Re-aggregate Metric via Group By
SELECT
metric_time__week
, booking__ds__month
booking__ds__month
, metric_time__week
, every_two_days_bookers_fill_nulls_with_0
FROM (
-- Compute Metrics via Expressions
-- Window Function for Metric Re-aggregation
SELECT
metric_time__week
, booking__ds__month
booking__ds__month
, metric_time__week
, FIRST_VALUE(COALESCE(bookers, 0)) OVER (
PARTITION BY
metric_time__week
, booking__ds__month
booking__ds__month
, metric_time__week
ORDER BY metric_time__day
ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
) AS every_two_days_bookers_fill_nulls_with_0
FROM (
-- Join to Time Spine Dataset
SELECT
subq_20.ds AS metric_time__day
DATE_TRUNC('month', subq_20.ds) AS booking__ds__month
, subq_20.ds AS metric_time__day
, DATE_TRUNC('week', subq_20.ds) AS metric_time__week
, subq_18.booking__ds__month AS booking__ds__month
, subq_18.bookers AS bookers
FROM ***************************.mf_time_spine subq_20
LEFT OUTER JOIN (
Expand Down Expand Up @@ -60,6 +60,6 @@ FROM (
) subq_21
) subq_23
GROUP BY
metric_time__week
, booking__ds__month
booking__ds__month
, metric_time__week
, every_two_days_bookers_fill_nulls_with_0
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@ FROM (
-- Join to Custom Granularity Dataset
SELECT
subq_2.booking__ds__day AS booking__ds__day
, DATE_TRUNC('week', subq_2.booking__ds__day) AS booking__ds__week
, DATE_TRUNC('month', subq_2.booking__ds__day) AS booking__ds__month
, DATE_TRUNC('quarter', subq_2.booking__ds__day) AS booking__ds__quarter
, DATE_TRUNC('year', subq_2.booking__ds__day) AS booking__ds__year
, EXTRACT(year FROM subq_2.booking__ds__day) AS booking__ds__extract_year
, EXTRACT(quarter FROM subq_2.booking__ds__day) AS booking__ds__extract_quarter
, EXTRACT(month FROM subq_2.booking__ds__day) AS booking__ds__extract_month
, EXTRACT(day FROM subq_2.booking__ds__day) AS booking__ds__extract_day
, EXTRACT(isodow FROM subq_2.booking__ds__day) AS booking__ds__extract_dow
, EXTRACT(doy FROM subq_2.booking__ds__day) AS booking__ds__extract_doy
, subq_1.ds__day AS ds__day
, subq_1.ds__week AS ds__week
, subq_1.ds__month AS ds__month
Expand Down Expand Up @@ -69,6 +59,16 @@ FROM (
, subq_1.paid_at__extract_day AS paid_at__extract_day
, subq_1.paid_at__extract_dow AS paid_at__extract_dow
, subq_1.paid_at__extract_doy AS paid_at__extract_doy
, subq_1.booking__ds__week AS booking__ds__week
, subq_1.booking__ds__month AS booking__ds__month
, subq_1.booking__ds__quarter AS booking__ds__quarter
, subq_1.booking__ds__year AS booking__ds__year
, subq_1.booking__ds__extract_year AS booking__ds__extract_year
, subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
, subq_1.booking__ds__extract_month AS booking__ds__extract_month
, subq_1.booking__ds__extract_day AS booking__ds__extract_day
, subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
, subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
, subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
, subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
, subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@ FROM (
SELECT
subq_5.metric_time__martian_day
, subq_5.metric_time__day
, subq_5.metric_time__week
, subq_5.metric_time__month
, subq_5.metric_time__quarter
, subq_5.metric_time__year
, subq_5.metric_time__extract_year
, subq_5.metric_time__extract_quarter
, subq_5.metric_time__extract_month
, subq_5.metric_time__extract_day
, subq_5.metric_time__extract_dow
, subq_5.metric_time__extract_doy
, subq_5.ds__day
, subq_5.ds__week
, subq_5.ds__month
Expand Down Expand Up @@ -102,6 +92,16 @@ FROM (
, subq_5.booking__paid_at__extract_day
, subq_5.booking__paid_at__extract_dow
, subq_5.booking__paid_at__extract_doy
, subq_5.metric_time__week
, subq_5.metric_time__month
, subq_5.metric_time__quarter
, subq_5.metric_time__year
, subq_5.metric_time__extract_year
, subq_5.metric_time__extract_quarter
, subq_5.metric_time__extract_month
, subq_5.metric_time__extract_day
, subq_5.metric_time__extract_dow
, subq_5.metric_time__extract_doy
, subq_5.listing
, subq_5.guest
, subq_5.host
Expand All @@ -128,16 +128,6 @@ FROM (
-- Join to Custom Granularity Dataset
SELECT
subq_2.metric_time__day AS metric_time__day
, DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week
, DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month
, DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter
, DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year
, EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year
, EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter
, EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month
, EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day
, EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow
, EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy
, subq_1.ds__day AS ds__day
, subq_1.ds__week AS ds__week
, subq_1.ds__month AS ds__month
Expand Down Expand Up @@ -204,6 +194,16 @@ FROM (
, subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
, subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
, subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
, subq_1.metric_time__week AS metric_time__week
, subq_1.metric_time__month AS metric_time__month
, subq_1.metric_time__quarter AS metric_time__quarter
, subq_1.metric_time__year AS metric_time__year
, subq_1.metric_time__extract_year AS metric_time__extract_year
, subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
, subq_1.metric_time__extract_month AS metric_time__extract_month
, subq_1.metric_time__extract_day AS metric_time__extract_day
, subq_1.metric_time__extract_dow AS metric_time__extract_dow
, subq_1.metric_time__extract_doy AS metric_time__extract_doy
, subq_1.listing AS listing
, subq_1.guest AS guest
, subq_1.host AS host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@ FROM (
-- Constrain Time Range to [2019-12-19T00:00:00, 2020-01-02T00:00:00]
SELECT
subq_7.metric_time__day
, subq_7.metric_time__week
, subq_7.metric_time__month
, subq_7.metric_time__quarter
, subq_7.metric_time__year
, subq_7.metric_time__extract_year
, subq_7.metric_time__extract_quarter
, subq_7.metric_time__extract_month
, subq_7.metric_time__extract_day
, subq_7.metric_time__extract_dow
, subq_7.metric_time__extract_doy
, subq_7.ds__day
, subq_7.ds__week
, subq_7.ds__month
Expand Down Expand Up @@ -101,6 +91,16 @@ FROM (
, subq_7.booking__paid_at__extract_day
, subq_7.booking__paid_at__extract_dow
, subq_7.booking__paid_at__extract_doy
, subq_7.metric_time__week
, subq_7.metric_time__month
, subq_7.metric_time__quarter
, subq_7.metric_time__year
, subq_7.metric_time__extract_year
, subq_7.metric_time__extract_quarter
, subq_7.metric_time__extract_month
, subq_7.metric_time__extract_day
, subq_7.metric_time__extract_dow
, subq_7.metric_time__extract_doy
, subq_7.listing
, subq_7.guest
, subq_7.host
Expand All @@ -126,16 +126,6 @@ FROM (
-- Join to Time Spine Dataset
SELECT
subq_5.metric_time__day AS metric_time__day
, DATE_TRUNC('week', subq_5.metric_time__day) AS metric_time__week
, DATE_TRUNC('month', subq_5.metric_time__day) AS metric_time__month
, DATE_TRUNC('quarter', subq_5.metric_time__day) AS metric_time__quarter
, DATE_TRUNC('year', subq_5.metric_time__day) AS metric_time__year
, EXTRACT(year FROM subq_5.metric_time__day) AS metric_time__extract_year
, EXTRACT(quarter FROM subq_5.metric_time__day) AS metric_time__extract_quarter
, EXTRACT(month FROM subq_5.metric_time__day) AS metric_time__extract_month
, EXTRACT(day FROM subq_5.metric_time__day) AS metric_time__extract_day
, EXTRACT(isodow FROM subq_5.metric_time__day) AS metric_time__extract_dow
, EXTRACT(doy FROM subq_5.metric_time__day) AS metric_time__extract_doy
, subq_4.ds__day AS ds__day
, subq_4.ds__week AS ds__week
, subq_4.ds__month AS ds__month
Expand Down Expand Up @@ -202,6 +192,16 @@ FROM (
, subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day
, subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
, subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
, subq_4.metric_time__week AS metric_time__week
, subq_4.metric_time__month AS metric_time__month
, subq_4.metric_time__quarter AS metric_time__quarter
, subq_4.metric_time__year AS metric_time__year
, subq_4.metric_time__extract_year AS metric_time__extract_year
, subq_4.metric_time__extract_quarter AS metric_time__extract_quarter
, subq_4.metric_time__extract_month AS metric_time__extract_month
, subq_4.metric_time__extract_day AS metric_time__extract_day
, subq_4.metric_time__extract_dow AS metric_time__extract_dow
, subq_4.metric_time__extract_doy AS metric_time__extract_doy
, subq_4.listing AS listing
, subq_4.guest AS guest
, subq_4.host AS host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ FROM (
-- Join to Time Spine Dataset
SELECT
subq_2.metric_time__month AS metric_time__month
, DATE_TRUNC('quarter', subq_2.metric_time__month) AS metric_time__quarter
, DATE_TRUNC('year', subq_2.metric_time__month) AS metric_time__year
, EXTRACT(year FROM subq_2.metric_time__month) AS metric_time__extract_year
, EXTRACT(quarter FROM subq_2.metric_time__month) AS metric_time__extract_quarter
, EXTRACT(month FROM subq_2.metric_time__month) AS metric_time__extract_month
, subq_1.ds__month AS ds__month
, subq_1.ds__quarter AS ds__quarter
, subq_1.ds__year AS ds__year
Expand All @@ -42,6 +37,11 @@ FROM (
, subq_1.booking_monthly__ds__extract_year AS booking_monthly__ds__extract_year
, subq_1.booking_monthly__ds__extract_quarter AS booking_monthly__ds__extract_quarter
, subq_1.booking_monthly__ds__extract_month AS booking_monthly__ds__extract_month
, subq_1.metric_time__quarter AS metric_time__quarter
, subq_1.metric_time__year AS metric_time__year
, subq_1.metric_time__extract_year AS metric_time__extract_year
, subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
, subq_1.metric_time__extract_month AS metric_time__extract_month
, subq_1.listing AS listing
, subq_1.booking_monthly__listing AS booking_monthly__listing
, subq_1.bookings_monthly AS bookings_monthly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,16 +246,6 @@ FROM (
-- Join to Time Spine Dataset
SELECT
subq_7.metric_time__day AS metric_time__day
, DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week
, DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month
, DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter
, DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year
, EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year
, EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter
, EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month
, EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day
, EXTRACT(isodow FROM subq_7.metric_time__day) AS metric_time__extract_dow
, EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy
, subq_6.ds__day AS ds__day
, subq_6.ds__week AS ds__week
, subq_6.ds__month AS ds__month
Expand Down Expand Up @@ -322,6 +312,16 @@ FROM (
, subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
, subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
, subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
, subq_6.metric_time__week AS metric_time__week
, subq_6.metric_time__month AS metric_time__month
, subq_6.metric_time__quarter AS metric_time__quarter
, subq_6.metric_time__year AS metric_time__year
, subq_6.metric_time__extract_year AS metric_time__extract_year
, subq_6.metric_time__extract_quarter AS metric_time__extract_quarter
, subq_6.metric_time__extract_month AS metric_time__extract_month
, subq_6.metric_time__extract_day AS metric_time__extract_day
, subq_6.metric_time__extract_dow AS metric_time__extract_dow
, subq_6.metric_time__extract_doy AS metric_time__extract_doy
, subq_6.listing AS listing
, subq_6.guest AS guest
, subq_6.host AS host
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,17 +245,7 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
subq_7.metric_time__day AS metric_time__day
, DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week
, DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month
, DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter
, DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year
, EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year
, EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter
, EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month
, EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day
, EXTRACT(isodow FROM subq_7.metric_time__day) AS metric_time__extract_dow
, EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy
DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week
, subq_6.ds__day AS ds__day
, subq_6.ds__week AS ds__week
, subq_6.ds__month AS ds__month
Expand Down Expand Up @@ -322,6 +312,16 @@ FROM (
, subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
, subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
, subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
, subq_6.metric_time__day AS metric_time__day
, subq_6.metric_time__month AS metric_time__month
, subq_6.metric_time__quarter AS metric_time__quarter
, subq_6.metric_time__year AS metric_time__year
, subq_6.metric_time__extract_year AS metric_time__extract_year
, subq_6.metric_time__extract_quarter AS metric_time__extract_quarter
, subq_6.metric_time__extract_month AS metric_time__extract_month
, subq_6.metric_time__extract_day AS metric_time__extract_day
, subq_6.metric_time__extract_dow AS metric_time__extract_dow
, subq_6.metric_time__extract_doy AS metric_time__extract_doy
, subq_6.listing AS listing
, subq_6.guest AS guest
, subq_6.host AS host
Expand Down
Loading

0 comments on commit 81e54f2

Please sign in to comment.