-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SQL tests for simple metrics with sub-daily dimensions
- Loading branch information
1 parent
4e60281
commit cf47d11
Showing
29 changed files
with
12,318 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
1,303 changes: 1,303 additions & 0 deletions
1,303
...ng.py/SqlQueryPlan/BigQuery/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql
Large diffs are not rendered by default.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
...ueryPlan/BigQuery/test_simple_metric_with_joined_sub_daily_dimension__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,38 @@ | ||
-- Join Standard Outputs | ||
-- Pass Only Elements: ['bookings', 'listing__user__bio_added_ts__minute'] | ||
-- Aggregate Measures | ||
-- Compute Metrics via Expressions | ||
SELECT | ||
subq_22.user__bio_added_ts__minute AS listing__user__bio_added_ts__minute | ||
, SUM(subq_15.bookings) AS bookings | ||
FROM ( | ||
-- Read Elements From Semantic Model 'bookings_source' | ||
-- Metric Time Dimension 'ds' | ||
-- Pass Only Elements: ['bookings', 'ds_partitioned__day', 'listing'] | ||
SELECT | ||
DATETIME_TRUNC(ds_partitioned, day) AS ds_partitioned__day | ||
, listing_id AS listing | ||
, 1 AS bookings | ||
FROM ***************************.fct_bookings bookings_source_src_28000 | ||
) subq_15 | ||
LEFT OUTER JOIN ( | ||
-- Join Standard Outputs | ||
-- Pass Only Elements: ['user__ds_partitioned__day', 'user__bio_added_ts__minute', 'listing'] | ||
SELECT | ||
DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, day) AS user__ds_partitioned__day | ||
, DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, minute) AS user__bio_added_ts__minute | ||
, listings_latest_src_28000.listing_id AS listing | ||
FROM ***************************.dim_listings_latest listings_latest_src_28000 | ||
LEFT OUTER JOIN | ||
***************************.dim_users users_ds_source_src_28000 | ||
ON | ||
listings_latest_src_28000.user_id = users_ds_source_src_28000.user_id | ||
) subq_22 | ||
ON | ||
( | ||
subq_15.listing = subq_22.listing | ||
) AND ( | ||
subq_15.ds_partitioned__day = subq_22.user__ds_partitioned__day | ||
) | ||
GROUP BY | ||
listing__user__bio_added_ts__minute |
394 changes: 394 additions & 0 deletions
394
...rendering.py/SqlQueryPlan/BigQuery/test_simple_metric_with_sub_daily_dimension__plan0.sql
Large diffs are not rendered by default.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
...py/SqlQueryPlan/BigQuery/test_simple_metric_with_sub_daily_dimension__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,16 @@ | ||
-- Aggregate Measures | ||
-- Compute Metrics via Expressions | ||
SELECT | ||
user__archived_at__hour | ||
, SUM(new_users) AS new_users | ||
FROM ( | ||
-- Read Elements From Semantic Model 'users_ds_source' | ||
-- Metric Time Dimension 'created_at' | ||
-- Pass Only Elements: ['new_users', 'user__archived_at__hour'] | ||
SELECT | ||
DATETIME_TRUNC(archived_at, hour) AS user__archived_at__hour | ||
, 1 AS new_users | ||
FROM ***************************.dim_users users_ds_source_src_28000 | ||
) subq_6 | ||
GROUP BY | ||
user__archived_at__hour |
1,303 changes: 1,303 additions & 0 deletions
1,303
....py/SqlQueryPlan/Databricks/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql
Large diffs are not rendered by default.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
...ryPlan/Databricks/test_simple_metric_with_joined_sub_daily_dimension__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,38 @@ | ||
-- Join Standard Outputs | ||
-- Pass Only Elements: ['bookings', 'listing__user__bio_added_ts__minute'] | ||
-- Aggregate Measures | ||
-- Compute Metrics via Expressions | ||
SELECT | ||
subq_22.user__bio_added_ts__minute AS listing__user__bio_added_ts__minute | ||
, SUM(subq_15.bookings) AS bookings | ||
FROM ( | ||
-- Read Elements From Semantic Model 'bookings_source' | ||
-- Metric Time Dimension 'ds' | ||
-- Pass Only Elements: ['bookings', 'ds_partitioned__day', 'listing'] | ||
SELECT | ||
DATE_TRUNC('day', ds_partitioned) AS ds_partitioned__day | ||
, listing_id AS listing | ||
, 1 AS bookings | ||
FROM ***************************.fct_bookings bookings_source_src_28000 | ||
) subq_15 | ||
LEFT OUTER JOIN ( | ||
-- Join Standard Outputs | ||
-- Pass Only Elements: ['user__ds_partitioned__day', 'user__bio_added_ts__minute', 'listing'] | ||
SELECT | ||
DATE_TRUNC('day', users_ds_source_src_28000.ds_partitioned) AS user__ds_partitioned__day | ||
, DATE_TRUNC('minute', users_ds_source_src_28000.bio_added_ts) AS user__bio_added_ts__minute | ||
, listings_latest_src_28000.listing_id AS listing | ||
FROM ***************************.dim_listings_latest listings_latest_src_28000 | ||
LEFT OUTER JOIN | ||
***************************.dim_users users_ds_source_src_28000 | ||
ON | ||
listings_latest_src_28000.user_id = users_ds_source_src_28000.user_id | ||
) subq_22 | ||
ON | ||
( | ||
subq_15.listing = subq_22.listing | ||
) AND ( | ||
subq_15.ds_partitioned__day = subq_22.user__ds_partitioned__day | ||
) | ||
GROUP BY | ||
subq_22.user__bio_added_ts__minute |
Oops, something went wrong.