-
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.
Add SQL rendering tests for no-metric queries
- Loading branch information
1 parent
e796355
commit 5267413
Showing
5 changed files
with
313 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
187 changes: 187 additions & 0 deletions
187
...ranularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_sub_daily_dimension__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,187 @@ | ||
-- Pass Only Elements: ['user__bio_added_ts__second',] | ||
SELECT | ||
subq_0.user__bio_added_ts__second | ||
FROM ( | ||
-- Read Elements From Semantic Model 'users_ds_source' | ||
SELECT | ||
DATE_TRUNC('day', users_ds_source_src_28000.ds) AS ds__day | ||
, DATE_TRUNC('week', users_ds_source_src_28000.ds) AS ds__week | ||
, DATE_TRUNC('month', users_ds_source_src_28000.ds) AS ds__month | ||
, DATE_TRUNC('quarter', users_ds_source_src_28000.ds) AS ds__quarter | ||
, DATE_TRUNC('year', users_ds_source_src_28000.ds) AS ds__year | ||
, EXTRACT(year FROM users_ds_source_src_28000.ds) AS ds__extract_year | ||
, EXTRACT(quarter FROM users_ds_source_src_28000.ds) AS ds__extract_quarter | ||
, EXTRACT(month FROM users_ds_source_src_28000.ds) AS ds__extract_month | ||
, EXTRACT(day FROM users_ds_source_src_28000.ds) AS ds__extract_day | ||
, EXTRACT(isodow FROM users_ds_source_src_28000.ds) AS ds__extract_dow | ||
, EXTRACT(doy FROM users_ds_source_src_28000.ds) AS ds__extract_doy | ||
, DATE_TRUNC('day', users_ds_source_src_28000.created_at) AS created_at__day | ||
, DATE_TRUNC('week', users_ds_source_src_28000.created_at) AS created_at__week | ||
, DATE_TRUNC('month', users_ds_source_src_28000.created_at) AS created_at__month | ||
, DATE_TRUNC('quarter', users_ds_source_src_28000.created_at) AS created_at__quarter | ||
, DATE_TRUNC('year', users_ds_source_src_28000.created_at) AS created_at__year | ||
, EXTRACT(year FROM users_ds_source_src_28000.created_at) AS created_at__extract_year | ||
, EXTRACT(quarter FROM users_ds_source_src_28000.created_at) AS created_at__extract_quarter | ||
, EXTRACT(month FROM users_ds_source_src_28000.created_at) AS created_at__extract_month | ||
, EXTRACT(day FROM users_ds_source_src_28000.created_at) AS created_at__extract_day | ||
, EXTRACT(isodow FROM users_ds_source_src_28000.created_at) AS created_at__extract_dow | ||
, EXTRACT(doy FROM users_ds_source_src_28000.created_at) AS created_at__extract_doy | ||
, DATE_TRUNC('day', users_ds_source_src_28000.ds_partitioned) AS ds_partitioned__day | ||
, DATE_TRUNC('week', users_ds_source_src_28000.ds_partitioned) AS ds_partitioned__week | ||
, DATE_TRUNC('month', users_ds_source_src_28000.ds_partitioned) AS ds_partitioned__month | ||
, DATE_TRUNC('quarter', users_ds_source_src_28000.ds_partitioned) AS ds_partitioned__quarter | ||
, DATE_TRUNC('year', users_ds_source_src_28000.ds_partitioned) AS ds_partitioned__year | ||
, EXTRACT(year FROM users_ds_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year | ||
, EXTRACT(quarter FROM users_ds_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter | ||
, EXTRACT(month FROM users_ds_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month | ||
, EXTRACT(day FROM users_ds_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day | ||
, EXTRACT(isodow FROM users_ds_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow | ||
, EXTRACT(doy FROM users_ds_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy | ||
, users_ds_source_src_28000.home_state | ||
, DATE_TRUNC('millisecond', users_ds_source_src_28000.last_profile_edit_ts) AS last_profile_edit_ts__millisecond | ||
, DATE_TRUNC('second', users_ds_source_src_28000.last_profile_edit_ts) AS last_profile_edit_ts__second | ||
, DATE_TRUNC('minute', users_ds_source_src_28000.last_profile_edit_ts) AS last_profile_edit_ts__minute | ||
, DATE_TRUNC('hour', users_ds_source_src_28000.last_profile_edit_ts) AS last_profile_edit_ts__hour | ||
, DATE_TRUNC('day', users_ds_source_src_28000.last_profile_edit_ts) AS last_profile_edit_ts__day | ||
, DATE_TRUNC('week', users_ds_source_src_28000.last_profile_edit_ts) AS last_profile_edit_ts__week | ||
, DATE_TRUNC('month', users_ds_source_src_28000.last_profile_edit_ts) AS last_profile_edit_ts__month | ||
, DATE_TRUNC('quarter', users_ds_source_src_28000.last_profile_edit_ts) AS last_profile_edit_ts__quarter | ||
, DATE_TRUNC('year', users_ds_source_src_28000.last_profile_edit_ts) AS last_profile_edit_ts__year | ||
, EXTRACT(year FROM users_ds_source_src_28000.last_profile_edit_ts) AS last_profile_edit_ts__extract_year | ||
, EXTRACT(quarter FROM users_ds_source_src_28000.last_profile_edit_ts) AS last_profile_edit_ts__extract_quarter | ||
, EXTRACT(month FROM users_ds_source_src_28000.last_profile_edit_ts) AS last_profile_edit_ts__extract_month | ||
, EXTRACT(day FROM users_ds_source_src_28000.last_profile_edit_ts) AS last_profile_edit_ts__extract_day | ||
, EXTRACT(isodow FROM users_ds_source_src_28000.last_profile_edit_ts) AS last_profile_edit_ts__extract_dow | ||
, EXTRACT(doy FROM users_ds_source_src_28000.last_profile_edit_ts) AS last_profile_edit_ts__extract_doy | ||
, DATE_TRUNC('second', users_ds_source_src_28000.bio_added_ts) AS bio_added_ts__second | ||
, DATE_TRUNC('minute', users_ds_source_src_28000.bio_added_ts) AS bio_added_ts__minute | ||
, DATE_TRUNC('hour', users_ds_source_src_28000.bio_added_ts) AS bio_added_ts__hour | ||
, DATE_TRUNC('day', users_ds_source_src_28000.bio_added_ts) AS bio_added_ts__day | ||
, DATE_TRUNC('week', users_ds_source_src_28000.bio_added_ts) AS bio_added_ts__week | ||
, DATE_TRUNC('month', users_ds_source_src_28000.bio_added_ts) AS bio_added_ts__month | ||
, DATE_TRUNC('quarter', users_ds_source_src_28000.bio_added_ts) AS bio_added_ts__quarter | ||
, DATE_TRUNC('year', users_ds_source_src_28000.bio_added_ts) AS bio_added_ts__year | ||
, EXTRACT(year FROM users_ds_source_src_28000.bio_added_ts) AS bio_added_ts__extract_year | ||
, EXTRACT(quarter FROM users_ds_source_src_28000.bio_added_ts) AS bio_added_ts__extract_quarter | ||
, EXTRACT(month FROM users_ds_source_src_28000.bio_added_ts) AS bio_added_ts__extract_month | ||
, EXTRACT(day FROM users_ds_source_src_28000.bio_added_ts) AS bio_added_ts__extract_day | ||
, EXTRACT(isodow FROM users_ds_source_src_28000.bio_added_ts) AS bio_added_ts__extract_dow | ||
, EXTRACT(doy FROM users_ds_source_src_28000.bio_added_ts) AS bio_added_ts__extract_doy | ||
, DATE_TRUNC('minute', users_ds_source_src_28000.last_login_ts) AS last_login_ts__minute | ||
, DATE_TRUNC('hour', users_ds_source_src_28000.last_login_ts) AS last_login_ts__hour | ||
, DATE_TRUNC('day', users_ds_source_src_28000.last_login_ts) AS last_login_ts__day | ||
, DATE_TRUNC('week', users_ds_source_src_28000.last_login_ts) AS last_login_ts__week | ||
, DATE_TRUNC('month', users_ds_source_src_28000.last_login_ts) AS last_login_ts__month | ||
, DATE_TRUNC('quarter', users_ds_source_src_28000.last_login_ts) AS last_login_ts__quarter | ||
, DATE_TRUNC('year', users_ds_source_src_28000.last_login_ts) AS last_login_ts__year | ||
, EXTRACT(year FROM users_ds_source_src_28000.last_login_ts) AS last_login_ts__extract_year | ||
, EXTRACT(quarter FROM users_ds_source_src_28000.last_login_ts) AS last_login_ts__extract_quarter | ||
, EXTRACT(month FROM users_ds_source_src_28000.last_login_ts) AS last_login_ts__extract_month | ||
, EXTRACT(day FROM users_ds_source_src_28000.last_login_ts) AS last_login_ts__extract_day | ||
, EXTRACT(isodow FROM users_ds_source_src_28000.last_login_ts) AS last_login_ts__extract_dow | ||
, EXTRACT(doy FROM users_ds_source_src_28000.last_login_ts) AS last_login_ts__extract_doy | ||
, DATE_TRUNC('hour', users_ds_source_src_28000.archived_at) AS archived_at__hour | ||
, DATE_TRUNC('day', users_ds_source_src_28000.archived_at) AS archived_at__day | ||
, DATE_TRUNC('week', users_ds_source_src_28000.archived_at) AS archived_at__week | ||
, DATE_TRUNC('month', users_ds_source_src_28000.archived_at) AS archived_at__month | ||
, DATE_TRUNC('quarter', users_ds_source_src_28000.archived_at) AS archived_at__quarter | ||
, DATE_TRUNC('year', users_ds_source_src_28000.archived_at) AS archived_at__year | ||
, EXTRACT(year FROM users_ds_source_src_28000.archived_at) AS archived_at__extract_year | ||
, EXTRACT(quarter FROM users_ds_source_src_28000.archived_at) AS archived_at__extract_quarter | ||
, EXTRACT(month FROM users_ds_source_src_28000.archived_at) AS archived_at__extract_month | ||
, EXTRACT(day FROM users_ds_source_src_28000.archived_at) AS archived_at__extract_day | ||
, EXTRACT(isodow FROM users_ds_source_src_28000.archived_at) AS archived_at__extract_dow | ||
, EXTRACT(doy FROM users_ds_source_src_28000.archived_at) AS archived_at__extract_doy | ||
, DATE_TRUNC('day', users_ds_source_src_28000.ds) AS user__ds__day | ||
, DATE_TRUNC('week', users_ds_source_src_28000.ds) AS user__ds__week | ||
, DATE_TRUNC('month', users_ds_source_src_28000.ds) AS user__ds__month | ||
, DATE_TRUNC('quarter', users_ds_source_src_28000.ds) AS user__ds__quarter | ||
, DATE_TRUNC('year', users_ds_source_src_28000.ds) AS user__ds__year | ||
, EXTRACT(year FROM users_ds_source_src_28000.ds) AS user__ds__extract_year | ||
, EXTRACT(quarter FROM users_ds_source_src_28000.ds) AS user__ds__extract_quarter | ||
, EXTRACT(month FROM users_ds_source_src_28000.ds) AS user__ds__extract_month | ||
, EXTRACT(day FROM users_ds_source_src_28000.ds) AS user__ds__extract_day | ||
, EXTRACT(isodow FROM users_ds_source_src_28000.ds) AS user__ds__extract_dow | ||
, EXTRACT(doy FROM users_ds_source_src_28000.ds) AS user__ds__extract_doy | ||
, DATE_TRUNC('day', users_ds_source_src_28000.created_at) AS user__created_at__day | ||
, DATE_TRUNC('week', users_ds_source_src_28000.created_at) AS user__created_at__week | ||
, DATE_TRUNC('month', users_ds_source_src_28000.created_at) AS user__created_at__month | ||
, DATE_TRUNC('quarter', users_ds_source_src_28000.created_at) AS user__created_at__quarter | ||
, DATE_TRUNC('year', users_ds_source_src_28000.created_at) AS user__created_at__year | ||
, EXTRACT(year FROM users_ds_source_src_28000.created_at) AS user__created_at__extract_year | ||
, EXTRACT(quarter FROM users_ds_source_src_28000.created_at) AS user__created_at__extract_quarter | ||
, EXTRACT(month FROM users_ds_source_src_28000.created_at) AS user__created_at__extract_month | ||
, EXTRACT(day FROM users_ds_source_src_28000.created_at) AS user__created_at__extract_day | ||
, EXTRACT(isodow FROM users_ds_source_src_28000.created_at) AS user__created_at__extract_dow | ||
, EXTRACT(doy FROM users_ds_source_src_28000.created_at) AS user__created_at__extract_doy | ||
, DATE_TRUNC('day', users_ds_source_src_28000.ds_partitioned) AS user__ds_partitioned__day | ||
, DATE_TRUNC('week', users_ds_source_src_28000.ds_partitioned) AS user__ds_partitioned__week | ||
, DATE_TRUNC('month', users_ds_source_src_28000.ds_partitioned) AS user__ds_partitioned__month | ||
, DATE_TRUNC('quarter', users_ds_source_src_28000.ds_partitioned) AS user__ds_partitioned__quarter | ||
, DATE_TRUNC('year', users_ds_source_src_28000.ds_partitioned) AS user__ds_partitioned__year | ||
, EXTRACT(year FROM users_ds_source_src_28000.ds_partitioned) AS user__ds_partitioned__extract_year | ||
, EXTRACT(quarter FROM users_ds_source_src_28000.ds_partitioned) AS user__ds_partitioned__extract_quarter | ||
, EXTRACT(month FROM users_ds_source_src_28000.ds_partitioned) AS user__ds_partitioned__extract_month | ||
, EXTRACT(day FROM users_ds_source_src_28000.ds_partitioned) AS user__ds_partitioned__extract_day | ||
, EXTRACT(isodow FROM users_ds_source_src_28000.ds_partitioned) AS user__ds_partitioned__extract_dow | ||
, EXTRACT(doy FROM users_ds_source_src_28000.ds_partitioned) AS user__ds_partitioned__extract_doy | ||
, users_ds_source_src_28000.home_state AS user__home_state | ||
, DATE_TRUNC('millisecond', users_ds_source_src_28000.last_profile_edit_ts) AS user__last_profile_edit_ts__millisecond | ||
, DATE_TRUNC('second', users_ds_source_src_28000.last_profile_edit_ts) AS user__last_profile_edit_ts__second | ||
, DATE_TRUNC('minute', users_ds_source_src_28000.last_profile_edit_ts) AS user__last_profile_edit_ts__minute | ||
, DATE_TRUNC('hour', users_ds_source_src_28000.last_profile_edit_ts) AS user__last_profile_edit_ts__hour | ||
, DATE_TRUNC('day', users_ds_source_src_28000.last_profile_edit_ts) AS user__last_profile_edit_ts__day | ||
, DATE_TRUNC('week', users_ds_source_src_28000.last_profile_edit_ts) AS user__last_profile_edit_ts__week | ||
, DATE_TRUNC('month', users_ds_source_src_28000.last_profile_edit_ts) AS user__last_profile_edit_ts__month | ||
, DATE_TRUNC('quarter', users_ds_source_src_28000.last_profile_edit_ts) AS user__last_profile_edit_ts__quarter | ||
, DATE_TRUNC('year', users_ds_source_src_28000.last_profile_edit_ts) AS user__last_profile_edit_ts__year | ||
, EXTRACT(year FROM users_ds_source_src_28000.last_profile_edit_ts) AS user__last_profile_edit_ts__extract_year | ||
, EXTRACT(quarter FROM users_ds_source_src_28000.last_profile_edit_ts) AS user__last_profile_edit_ts__extract_quarter | ||
, EXTRACT(month FROM users_ds_source_src_28000.last_profile_edit_ts) AS user__last_profile_edit_ts__extract_month | ||
, EXTRACT(day FROM users_ds_source_src_28000.last_profile_edit_ts) AS user__last_profile_edit_ts__extract_day | ||
, EXTRACT(isodow FROM users_ds_source_src_28000.last_profile_edit_ts) AS user__last_profile_edit_ts__extract_dow | ||
, EXTRACT(doy FROM users_ds_source_src_28000.last_profile_edit_ts) AS user__last_profile_edit_ts__extract_doy | ||
, DATE_TRUNC('second', users_ds_source_src_28000.bio_added_ts) AS user__bio_added_ts__second | ||
, DATE_TRUNC('minute', users_ds_source_src_28000.bio_added_ts) AS user__bio_added_ts__minute | ||
, DATE_TRUNC('hour', users_ds_source_src_28000.bio_added_ts) AS user__bio_added_ts__hour | ||
, DATE_TRUNC('day', users_ds_source_src_28000.bio_added_ts) AS user__bio_added_ts__day | ||
, DATE_TRUNC('week', users_ds_source_src_28000.bio_added_ts) AS user__bio_added_ts__week | ||
, DATE_TRUNC('month', users_ds_source_src_28000.bio_added_ts) AS user__bio_added_ts__month | ||
, DATE_TRUNC('quarter', users_ds_source_src_28000.bio_added_ts) AS user__bio_added_ts__quarter | ||
, DATE_TRUNC('year', users_ds_source_src_28000.bio_added_ts) AS user__bio_added_ts__year | ||
, EXTRACT(year FROM users_ds_source_src_28000.bio_added_ts) AS user__bio_added_ts__extract_year | ||
, EXTRACT(quarter FROM users_ds_source_src_28000.bio_added_ts) AS user__bio_added_ts__extract_quarter | ||
, EXTRACT(month FROM users_ds_source_src_28000.bio_added_ts) AS user__bio_added_ts__extract_month | ||
, EXTRACT(day FROM users_ds_source_src_28000.bio_added_ts) AS user__bio_added_ts__extract_day | ||
, EXTRACT(isodow FROM users_ds_source_src_28000.bio_added_ts) AS user__bio_added_ts__extract_dow | ||
, EXTRACT(doy FROM users_ds_source_src_28000.bio_added_ts) AS user__bio_added_ts__extract_doy | ||
, DATE_TRUNC('minute', users_ds_source_src_28000.last_login_ts) AS user__last_login_ts__minute | ||
, DATE_TRUNC('hour', users_ds_source_src_28000.last_login_ts) AS user__last_login_ts__hour | ||
, DATE_TRUNC('day', users_ds_source_src_28000.last_login_ts) AS user__last_login_ts__day | ||
, DATE_TRUNC('week', users_ds_source_src_28000.last_login_ts) AS user__last_login_ts__week | ||
, DATE_TRUNC('month', users_ds_source_src_28000.last_login_ts) AS user__last_login_ts__month | ||
, DATE_TRUNC('quarter', users_ds_source_src_28000.last_login_ts) AS user__last_login_ts__quarter | ||
, DATE_TRUNC('year', users_ds_source_src_28000.last_login_ts) AS user__last_login_ts__year | ||
, EXTRACT(year FROM users_ds_source_src_28000.last_login_ts) AS user__last_login_ts__extract_year | ||
, EXTRACT(quarter FROM users_ds_source_src_28000.last_login_ts) AS user__last_login_ts__extract_quarter | ||
, EXTRACT(month FROM users_ds_source_src_28000.last_login_ts) AS user__last_login_ts__extract_month | ||
, EXTRACT(day FROM users_ds_source_src_28000.last_login_ts) AS user__last_login_ts__extract_day | ||
, EXTRACT(isodow FROM users_ds_source_src_28000.last_login_ts) AS user__last_login_ts__extract_dow | ||
, EXTRACT(doy FROM users_ds_source_src_28000.last_login_ts) AS user__last_login_ts__extract_doy | ||
, DATE_TRUNC('hour', users_ds_source_src_28000.archived_at) AS user__archived_at__hour | ||
, DATE_TRUNC('day', users_ds_source_src_28000.archived_at) AS user__archived_at__day | ||
, DATE_TRUNC('week', users_ds_source_src_28000.archived_at) AS user__archived_at__week | ||
, DATE_TRUNC('month', users_ds_source_src_28000.archived_at) AS user__archived_at__month | ||
, DATE_TRUNC('quarter', users_ds_source_src_28000.archived_at) AS user__archived_at__quarter | ||
, DATE_TRUNC('year', users_ds_source_src_28000.archived_at) AS user__archived_at__year | ||
, EXTRACT(year FROM users_ds_source_src_28000.archived_at) AS user__archived_at__extract_year | ||
, EXTRACT(quarter FROM users_ds_source_src_28000.archived_at) AS user__archived_at__extract_quarter | ||
, EXTRACT(month FROM users_ds_source_src_28000.archived_at) AS user__archived_at__extract_month | ||
, EXTRACT(day FROM users_ds_source_src_28000.archived_at) AS user__archived_at__extract_day | ||
, EXTRACT(isodow FROM users_ds_source_src_28000.archived_at) AS user__archived_at__extract_dow | ||
, EXTRACT(doy FROM users_ds_source_src_28000.archived_at) AS user__archived_at__extract_doy | ||
, users_ds_source_src_28000.user_id AS user | ||
FROM ***************************.dim_users users_ds_source_src_28000 | ||
) subq_0 | ||
GROUP BY | ||
subq_0.user__bio_added_ts__second |
7 changes: 7 additions & 0 deletions
7
..._date_part_rendering.py/SqlQueryPlan/DuckDB/test_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,7 @@ | ||
-- Read Elements From Semantic Model 'users_ds_source' | ||
-- Pass Only Elements: ['user__bio_added_ts__second',] | ||
SELECT | ||
DATE_TRUNC('second', bio_added_ts) AS user__bio_added_ts__second | ||
FROM ***************************.dim_users users_ds_source_src_28000 | ||
GROUP BY | ||
DATE_TRUNC('second', bio_added_ts) |
Oops, something went wrong.