-
Notifications
You must be signed in to change notification settings - Fork 94
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
e09820a
commit 3feccdc
Showing
48 changed files
with
4,926 additions
and
0 deletions.
There are no files selected for viewing
134 changes: 134 additions & 0 deletions
134
...larity.py/SqlQueryPlan/BigQuery/test_no_metrics_with_custom_granularity_filter__plan0.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,134 @@ | ||
-- Pass Only Elements: ['listing__ds__day',] | ||
SELECT | ||
subq_2.listing__ds__day | ||
FROM ( | ||
-- Constrain Output with WHERE | ||
SELECT | ||
subq_1.listing__ds__martian_day | ||
, subq_1.ds__day | ||
, subq_1.ds__week | ||
, subq_1.ds__month | ||
, subq_1.ds__quarter | ||
, subq_1.ds__year | ||
, subq_1.ds__extract_year | ||
, subq_1.ds__extract_quarter | ||
, subq_1.ds__extract_month | ||
, subq_1.ds__extract_day | ||
, subq_1.ds__extract_dow | ||
, subq_1.ds__extract_doy | ||
, subq_1.created_at__day | ||
, subq_1.created_at__week | ||
, subq_1.created_at__month | ||
, subq_1.created_at__quarter | ||
, subq_1.created_at__year | ||
, subq_1.created_at__extract_year | ||
, subq_1.created_at__extract_quarter | ||
, subq_1.created_at__extract_month | ||
, subq_1.created_at__extract_day | ||
, subq_1.created_at__extract_dow | ||
, subq_1.created_at__extract_doy | ||
, subq_1.listing__ds__day | ||
, subq_1.listing__ds__week | ||
, subq_1.listing__ds__month | ||
, subq_1.listing__ds__quarter | ||
, subq_1.listing__ds__year | ||
, subq_1.listing__ds__extract_year | ||
, subq_1.listing__ds__extract_quarter | ||
, subq_1.listing__ds__extract_month | ||
, subq_1.listing__ds__extract_day | ||
, subq_1.listing__ds__extract_dow | ||
, subq_1.listing__ds__extract_doy | ||
, subq_1.listing__created_at__day | ||
, subq_1.listing__created_at__week | ||
, subq_1.listing__created_at__month | ||
, subq_1.listing__created_at__quarter | ||
, subq_1.listing__created_at__year | ||
, subq_1.listing__created_at__extract_year | ||
, subq_1.listing__created_at__extract_quarter | ||
, subq_1.listing__created_at__extract_month | ||
, subq_1.listing__created_at__extract_day | ||
, subq_1.listing__created_at__extract_dow | ||
, subq_1.listing__created_at__extract_doy | ||
, subq_1.listing | ||
, subq_1.user | ||
, subq_1.listing__user | ||
, subq_1.country_latest | ||
, subq_1.is_lux_latest | ||
, subq_1.capacity_latest | ||
, subq_1.listing__country_latest | ||
, subq_1.listing__is_lux_latest | ||
, subq_1.listing__capacity_latest | ||
, subq_1.listings | ||
, subq_1.largest_listing | ||
, subq_1.smallest_listing | ||
FROM ( | ||
-- Read Elements From Semantic Model 'listings_latest' | ||
-- Join to Custom Granularity Dataset | ||
SELECT | ||
1 AS listings | ||
, listings_latest_src_28000.capacity AS largest_listing | ||
, listings_latest_src_28000.capacity AS smallest_listing | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year | ||
, EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year | ||
, EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter | ||
, EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month | ||
, EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day | ||
, IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow | ||
, EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year | ||
, EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year | ||
, EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter | ||
, EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month | ||
, EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day | ||
, IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS created_at__extract_dow | ||
, EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS created_at__extract_doy | ||
, listings_latest_src_28000.country AS country_latest | ||
, listings_latest_src_28000.is_lux AS is_lux_latest | ||
, listings_latest_src_28000.capacity AS capacity_latest | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year | ||
, EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year | ||
, EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter | ||
, EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month | ||
, EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day | ||
, IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow | ||
, EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year | ||
, EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year | ||
, EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter | ||
, EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month | ||
, EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day | ||
, IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__created_at__extract_dow | ||
, EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy | ||
, listings_latest_src_28000.country AS listing__country_latest | ||
, listings_latest_src_28000.is_lux AS listing__is_lux_latest | ||
, listings_latest_src_28000.capacity AS listing__capacity_latest | ||
, listings_latest_src_28000.listing_id AS listing | ||
, listings_latest_src_28000.user_id AS user | ||
, listings_latest_src_28000.user_id AS listing__user | ||
, subq_0.martian_day AS listing__ds__martian_day | ||
FROM ***************************.dim_listings_latest listings_latest_src_28000 | ||
LEFT OUTER JOIN | ||
***************************.mf_time_spine subq_0 | ||
ON | ||
DATETIME_TRUNC(listings_latest_src_28000.created_at, day) = subq_0.ds | ||
) subq_1 | ||
WHERE listing__ds__martian_day = '2020-01-01' | ||
) subq_2 | ||
GROUP BY | ||
listing__ds__day |
19 changes: 19 additions & 0 deletions
19
...SqlQueryPlan/BigQuery/test_no_metrics_with_custom_granularity_filter__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,19 @@ | ||
-- Constrain Output with WHERE | ||
-- Pass Only Elements: ['listing__ds__day',] | ||
SELECT | ||
listing__ds__day | ||
FROM ( | ||
-- Read Elements From Semantic Model 'listings_latest' | ||
-- Join to Custom Granularity Dataset | ||
SELECT | ||
DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day | ||
, subq_3.martian_day AS listing__ds__martian_day | ||
FROM ***************************.dim_listings_latest listings_latest_src_28000 | ||
LEFT OUTER JOIN | ||
***************************.mf_time_spine subq_3 | ||
ON | ||
DATETIME_TRUNC(listings_latest_src_28000.created_at, day) = subq_3.ds | ||
) subq_4 | ||
WHERE listing__ds__martian_day = '2020-01-01' | ||
GROUP BY | ||
listing__ds__day |
134 changes: 134 additions & 0 deletions
134
...ryPlan/BigQuery/test_no_metrics_with_custom_granularity_in_filter_and_group_by__plan0.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,134 @@ | ||
-- Pass Only Elements: ['listing__ds__martian_day',] | ||
SELECT | ||
subq_2.listing__ds__martian_day | ||
FROM ( | ||
-- Constrain Output with WHERE | ||
SELECT | ||
subq_1.listing__ds__martian_day | ||
, subq_1.ds__day | ||
, subq_1.ds__week | ||
, subq_1.ds__month | ||
, subq_1.ds__quarter | ||
, subq_1.ds__year | ||
, subq_1.ds__extract_year | ||
, subq_1.ds__extract_quarter | ||
, subq_1.ds__extract_month | ||
, subq_1.ds__extract_day | ||
, subq_1.ds__extract_dow | ||
, subq_1.ds__extract_doy | ||
, subq_1.created_at__day | ||
, subq_1.created_at__week | ||
, subq_1.created_at__month | ||
, subq_1.created_at__quarter | ||
, subq_1.created_at__year | ||
, subq_1.created_at__extract_year | ||
, subq_1.created_at__extract_quarter | ||
, subq_1.created_at__extract_month | ||
, subq_1.created_at__extract_day | ||
, subq_1.created_at__extract_dow | ||
, subq_1.created_at__extract_doy | ||
, subq_1.listing__ds__day | ||
, subq_1.listing__ds__week | ||
, subq_1.listing__ds__month | ||
, subq_1.listing__ds__quarter | ||
, subq_1.listing__ds__year | ||
, subq_1.listing__ds__extract_year | ||
, subq_1.listing__ds__extract_quarter | ||
, subq_1.listing__ds__extract_month | ||
, subq_1.listing__ds__extract_day | ||
, subq_1.listing__ds__extract_dow | ||
, subq_1.listing__ds__extract_doy | ||
, subq_1.listing__created_at__day | ||
, subq_1.listing__created_at__week | ||
, subq_1.listing__created_at__month | ||
, subq_1.listing__created_at__quarter | ||
, subq_1.listing__created_at__year | ||
, subq_1.listing__created_at__extract_year | ||
, subq_1.listing__created_at__extract_quarter | ||
, subq_1.listing__created_at__extract_month | ||
, subq_1.listing__created_at__extract_day | ||
, subq_1.listing__created_at__extract_dow | ||
, subq_1.listing__created_at__extract_doy | ||
, subq_1.listing | ||
, subq_1.user | ||
, subq_1.listing__user | ||
, subq_1.country_latest | ||
, subq_1.is_lux_latest | ||
, subq_1.capacity_latest | ||
, subq_1.listing__country_latest | ||
, subq_1.listing__is_lux_latest | ||
, subq_1.listing__capacity_latest | ||
, subq_1.listings | ||
, subq_1.largest_listing | ||
, subq_1.smallest_listing | ||
FROM ( | ||
-- Read Elements From Semantic Model 'listings_latest' | ||
-- Join to Custom Granularity Dataset | ||
SELECT | ||
1 AS listings | ||
, listings_latest_src_28000.capacity AS largest_listing | ||
, listings_latest_src_28000.capacity AS smallest_listing | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS ds__day | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS ds__week | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS ds__month | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS ds__quarter | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS ds__year | ||
, EXTRACT(year FROM listings_latest_src_28000.created_at) AS ds__extract_year | ||
, EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS ds__extract_quarter | ||
, EXTRACT(month FROM listings_latest_src_28000.created_at) AS ds__extract_month | ||
, EXTRACT(day FROM listings_latest_src_28000.created_at) AS ds__extract_day | ||
, IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS ds__extract_dow | ||
, EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS ds__extract_doy | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS created_at__day | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS created_at__week | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS created_at__month | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS created_at__quarter | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS created_at__year | ||
, EXTRACT(year FROM listings_latest_src_28000.created_at) AS created_at__extract_year | ||
, EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS created_at__extract_quarter | ||
, EXTRACT(month FROM listings_latest_src_28000.created_at) AS created_at__extract_month | ||
, EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day | ||
, IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS created_at__extract_dow | ||
, EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS created_at__extract_doy | ||
, listings_latest_src_28000.country AS country_latest | ||
, listings_latest_src_28000.is_lux AS is_lux_latest | ||
, listings_latest_src_28000.capacity AS capacity_latest | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__ds__day | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__ds__week | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__ds__month | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__ds__quarter | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__ds__year | ||
, EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__ds__extract_year | ||
, EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__ds__extract_quarter | ||
, EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__ds__extract_month | ||
, EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__ds__extract_day | ||
, IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__ds__extract_dow | ||
, EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, day) AS listing__created_at__day | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, isoweek) AS listing__created_at__week | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, month) AS listing__created_at__month | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, quarter) AS listing__created_at__quarter | ||
, DATETIME_TRUNC(listings_latest_src_28000.created_at, year) AS listing__created_at__year | ||
, EXTRACT(year FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_year | ||
, EXTRACT(quarter FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_quarter | ||
, EXTRACT(month FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_month | ||
, EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day | ||
, IF(EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28000.created_at) - 1) AS listing__created_at__extract_dow | ||
, EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy | ||
, listings_latest_src_28000.country AS listing__country_latest | ||
, listings_latest_src_28000.is_lux AS listing__is_lux_latest | ||
, listings_latest_src_28000.capacity AS listing__capacity_latest | ||
, listings_latest_src_28000.listing_id AS listing | ||
, listings_latest_src_28000.user_id AS user | ||
, listings_latest_src_28000.user_id AS listing__user | ||
, subq_0.martian_day AS listing__ds__martian_day | ||
FROM ***************************.dim_listings_latest listings_latest_src_28000 | ||
LEFT OUTER JOIN | ||
***************************.mf_time_spine subq_0 | ||
ON | ||
DATETIME_TRUNC(listings_latest_src_28000.created_at, day) = subq_0.ds | ||
) subq_1 | ||
WHERE listing__ds__martian_day = '2020-01-01' | ||
) subq_2 | ||
GROUP BY | ||
listing__ds__martian_day |
18 changes: 18 additions & 0 deletions
18
...Query/test_no_metrics_with_custom_granularity_in_filter_and_group_by__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,18 @@ | ||
-- Constrain Output with WHERE | ||
-- Pass Only Elements: ['listing__ds__martian_day',] | ||
SELECT | ||
listing__ds__martian_day | ||
FROM ( | ||
-- Read Elements From Semantic Model 'listings_latest' | ||
-- Join to Custom Granularity Dataset | ||
SELECT | ||
subq_3.martian_day AS listing__ds__martian_day | ||
FROM ***************************.dim_listings_latest listings_latest_src_28000 | ||
LEFT OUTER JOIN | ||
***************************.mf_time_spine subq_3 | ||
ON | ||
DATETIME_TRUNC(listings_latest_src_28000.created_at, day) = subq_3.ds | ||
) subq_4 | ||
WHERE listing__ds__martian_day = '2020-01-01' | ||
GROUP BY | ||
listing__ds__martian_day |
Oops, something went wrong.