From 01f1d4e26106846338360a5e31a859cbf21e06fb Mon Sep 17 00:00:00 2001 From: Courtney Holcomb Date: Mon, 29 Jul 2024 12:23:13 -0700 Subject: [PATCH 1/3] Add check query tests for simple metrics with sub-daily dimensions --- .../semantic_models/user_sm_source.yaml | 9 ++++ .../integration/test_cases/itest_metrics.yaml | 51 +++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/simple_manifest/semantic_models/user_sm_source.yaml b/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/simple_manifest/semantic_models/user_sm_source.yaml index b0db8c59f1..6e36641f8e 100644 --- a/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/simple_manifest/semantic_models/user_sm_source.yaml +++ b/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/simple_manifest/semantic_models/user_sm_source.yaml @@ -7,6 +7,9 @@ semantic_model: schema_name: $source_schema alias: dim_users + defaults: + agg_time_dimension: created_at + dimensions: - name: ds type: time @@ -45,3 +48,9 @@ semantic_model: - name: user type: primary expr: user_id + + measures: + - name: new_users + expr: "1" + agg: SUM + create_metric: true \ No newline at end of file diff --git a/tests_metricflow/integration/test_cases/itest_metrics.yaml b/tests_metricflow/integration/test_cases/itest_metrics.yaml index 52b805f9ea..5cf84b6368 100644 --- a/tests_metricflow/integration/test_cases/itest_metrics.yaml +++ b/tests_metricflow/integration/test_cases/itest_metrics.yaml @@ -2215,3 +2215,54 @@ integration_test: GROUP BY {{ render_date_trunc("ds", TimeGranularity.DAY) }} ) a ON b.ds = a.ds WHERE {{ render_between_time_constraint("b.ds", "2020-01-03", "2020-01-03") }} +--- +integration_test: + name: simple_metric_with_sub_daily_dimension + description: Tests querying a metric with a sub-daily dimension + model: SIMPLE_MODEL + metrics: ["new_users"] + group_bys: ["user__last_profile_edit_ts__millisecond"] + check_query: | + SELECT + {{ render_date_trunc("last_profile_edit_ts", TimeGranularity.MILLISECOND) }} AS user__last_profile_edit_ts__millisecond + , SUM(1) AS new_users + FROM {{ source_schema }}.dim_users + GROUP BY {{ render_date_trunc("last_profile_edit_ts", TimeGranularity.MILLISECOND) }} +--- +integration_test: + name: simple_metric_with_joined_sub_daily_dimension + description: Tests querying a metric with a sub-daily dimension that requires a join + model: SIMPLE_MODEL + metrics: ["bookings"] + group_bys: ["user__last_login_ts__minute"] + check_query: | + SELECT + subq_8.user__last_login_ts__minute AS listing__user__last_login_ts__minute + , SUM(subq_2.bookings) AS bookings + FROM ( + SELECT + {{ render_date_trunc("ds_partitioned", TimeGranularity.DAY) }} AS ds_partitioned__day + , listing_id AS listing + , 1 AS bookings + FROM {{ source_schema }}.fct_bookings + ) subq_2 + LEFT OUTER JOIN ( + SELECT + {{ render_date_trunc("u.ds_partitioned", TimeGranularity.DAY) }} AS user__ds_partitioned__day + , {{ render_date_trunc("u.last_login_ts", TimeGranularity.MINUTE) }} AS user__last_login_ts__minute + , l.listing_id AS listing + FROM {{ source_schema }}.dim_listings_latest l + LEFT OUTER JOIN + {{ source_schema }}.dim_users u + ON + l.user_id = u.user_id + ) subq_8 + ON + ( + subq_2.listing = subq_8.listing + ) AND ( + subq_2.ds_partitioned__day = subq_8.user__ds_partitioned__day + ) + GROUP BY + subq_8.user__last_login_ts__minute + From 64df52c2b138110b52765f3e65645516512c9208 Mon Sep 17 00:00:00 2001 From: Courtney Holcomb Date: Mon, 29 Jul 2024 17:13:13 -0700 Subject: [PATCH 2/3] Update snapshots to include new metric This impacts the unoptimized SQL for all queries using this semantic model --- .../semantic_models/user_sm_source.yaml | 4 +- ...linkable_element_set_as_spec_set__set0.txt | 1 + .../dict/test_get_names__result0.txt | 1 + ...linkable_elements_for_measure__result0.txt | 1 + ...elements_for_no_metrics_query__result0.txt | 2 + .../integration/test_cases/itest_metrics.yaml | 1 - ...nversion_count_with_no_group_by__plan0.xml | 4 +- ...timespine_and_fill_nulls_with_0__plan0.xml | 4 +- .../test_conversion_rate__plan0.xml | 4 +- ...n_rate_with_constant_properties__plan0.xml | 4 +- ...onversion_rate_with_no_group_by__plan0.xml | 4 +- ...est_conversion_rate_with_window__plan0.xml | 4 +- ...mantic_model_ratio_metrics_plan__dfp_0.xml | 2 +- ...o_from_multiple_semantic_models__plan0.xml | 2 +- .../test_sub_daily_dimension__plan0.sql | 3 +- .../test_sub_daily_dimension__plan0.sql | 3 +- .../test_sub_daily_dimension__plan0.sql | 3 +- .../test_sub_daily_dimension__plan0.sql | 3 +- .../test_sub_daily_dimension__plan0.sql | 3 +- .../test_sub_daily_dimension__plan0.sql | 3 +- .../Trino/test_sub_daily_dimension__plan0.sql | 3 +- ...rsion_metric_predicate_pushdown__dfp_0.xml | 4 +- .../BigQuery/test_partitioned_join__plan0.sql | 588 +++++++++++------ ...test_partitioned_join__plan0_optimized.sql | 8 +- .../test_partitioned_join__plan0.sql | 590 ++++++++++++------ ...test_partitioned_join__plan0_optimized.sql | 8 +- .../DuckDB/test_partitioned_join__plan0.sql | 590 ++++++++++++------ ...test_partitioned_join__plan0_optimized.sql | 8 +- .../Postgres/test_partitioned_join__plan0.sql | 590 ++++++++++++------ ...test_partitioned_join__plan0_optimized.sql | 8 +- .../Redshift/test_partitioned_join__plan0.sql | 590 ++++++++++++------ ...test_partitioned_join__plan0_optimized.sql | 8 +- .../test_partitioned_join__plan0.sql | 590 ++++++++++++------ ...test_partitioned_join__plan0_optimized.sql | 8 +- .../Trino/test_partitioned_join__plan0.sql | 590 ++++++++++++------ ...test_partitioned_join__plan0_optimized.sql | 8 +- 36 files changed, 2808 insertions(+), 1439 deletions(-) diff --git a/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/simple_manifest/semantic_models/user_sm_source.yaml b/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/simple_manifest/semantic_models/user_sm_source.yaml index 6e36641f8e..dacb9689cf 100644 --- a/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/simple_manifest/semantic_models/user_sm_source.yaml +++ b/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/simple_manifest/semantic_models/user_sm_source.yaml @@ -9,7 +9,7 @@ semantic_model: defaults: agg_time_dimension: created_at - + dimensions: - name: ds type: time @@ -53,4 +53,4 @@ semantic_model: - name: new_users expr: "1" agg: SUM - create_metric: true \ No newline at end of file + create_metric: true diff --git a/metricflow-semantics/tests_metricflow_semantics/snapshots/test_linkable_spec_resolver.py/list/test_linkable_element_set_as_spec_set__set0.txt b/metricflow-semantics/tests_metricflow_semantics/snapshots/test_linkable_spec_resolver.py/list/test_linkable_element_set_as_spec_set__set0.txt index 321d452252..81f7d1538e 100644 --- a/metricflow-semantics/tests_metricflow_semantics/snapshots/test_linkable_spec_resolver.py/list/test_linkable_element_set_as_spec_set__set0.txt +++ b/metricflow-semantics/tests_metricflow_semantics/snapshots/test_linkable_spec_resolver.py/list/test_linkable_element_set_as_spec_set__set0.txt @@ -448,6 +448,7 @@ 'user__listing__user__views_times_booking_value', 'user__listings', 'user__lux_listings', + 'user__new_users', 'user__popular_listing_bookings_per_booker', 'user__regional_starting_balance_ratios', 'user__revenue', diff --git a/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/dict/test_get_names__result0.txt b/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/dict/test_get_names__result0.txt index b7da0d4916..f52d494f84 100644 --- a/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/dict/test_get_names__result0.txt +++ b/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/dict/test_get_names__result0.txt @@ -41,6 +41,7 @@ 'max_booking_value', 'median_booking_value', 'min_booking_value', + 'new_users', 'referred_bookings', 'smallest_listing', 'total_account_balance_first_day', diff --git a/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/str/test_linkable_elements_for_measure__result0.txt b/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/str/test_linkable_elements_for_measure__result0.txt index a9b388b32b..fa3dcb7aae 100644 --- a/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/str/test_linkable_elements_for_measure__result0.txt +++ b/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/str/test_linkable_elements_for_measure__result0.txt @@ -182,6 +182,7 @@ Model Join-Path Entity Links ('listings_latest',) ("('user',)", "('user',)") largest_listing ['JOINED', 'METRIC'] ('listings_latest',) ("('user',)", "('user',)") listings ['JOINED', 'METRIC'] ('listings_latest',) ("('user',)", "('user',)") lux_listings ['JOINED', 'METRIC'] +('listings_latest',) ("('user',)", "('user',)") new_users ['JOINED', 'METRIC'] ('listings_latest',) ("('user',)", "('user',)") popular_listing_bookings_per_booker ['JOINED', 'METRIC'] ('listings_latest',) ("('user',)", "('user',)") regional_starting_balance_ratios ['JOINED', 'METRIC'] ('listings_latest',) ("('user',)", "('user',)") revenue ['JOINED', 'METRIC'] diff --git a/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/tuple/test_linkable_elements_for_no_metrics_query__result0.txt b/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/tuple/test_linkable_elements_for_no_metrics_query__result0.txt index d27aa93bbf..8d687dd5cd 100644 --- a/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/tuple/test_linkable_elements_for_no_metrics_query__result0.txt +++ b/metricflow-semantics/tests_metricflow_semantics/snapshots/test_semantic_model_container.py/tuple/test_linkable_elements_for_no_metrics_query__result0.txt @@ -93,6 +93,7 @@ 'company__user__company__largest_listing', 'company__user__company__listings', 'company__user__company__lux_listings', + 'company__user__company__new_users', 'company__user__company__popular_listing_bookings_per_booker', 'company__user__company__regional_starting_balance_ratios', 'company__user__company__revenue', @@ -559,6 +560,7 @@ 'user__listing__user__views_times_booking_value', 'user__listings', 'user__lux_listings', + 'user__new_users', 'user__popular_listing_bookings_per_booker', 'user__regional_starting_balance_ratios', 'user__revenue', diff --git a/tests_metricflow/integration/test_cases/itest_metrics.yaml b/tests_metricflow/integration/test_cases/itest_metrics.yaml index 5cf84b6368..0036ed5587 100644 --- a/tests_metricflow/integration/test_cases/itest_metrics.yaml +++ b/tests_metricflow/integration/test_cases/itest_metrics.yaml @@ -2265,4 +2265,3 @@ integration_test: ) GROUP BY subq_8.user__last_login_ts__minute - diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_count_with_no_group_by__plan0.xml b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_count_with_no_group_by__plan0.xml index 433ca59f13..34342ed5c4 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_count_with_no_group_by__plan0.xml +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_count_with_no_group_by__plan0.xml @@ -239,7 +239,7 @@ - + @@ -694,7 +694,7 @@ - + diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_metric_join_to_timespine_and_fill_nulls_with_0__plan0.xml b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_metric_join_to_timespine_and_fill_nulls_with_0__plan0.xml index e68ffaf1c3..714dda14f3 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_metric_join_to_timespine_and_fill_nulls_with_0__plan0.xml +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_metric_join_to_timespine_and_fill_nulls_with_0__plan0.xml @@ -321,7 +321,7 @@ - + @@ -860,7 +860,7 @@ - + diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate__plan0.xml b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate__plan0.xml index 5b8f534958..d93ede7dd6 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate__plan0.xml +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate__plan0.xml @@ -267,7 +267,7 @@ - + @@ -753,7 +753,7 @@ - + diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_constant_properties__plan0.xml b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_constant_properties__plan0.xml index e25cc35467..bf2e7fd549 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_constant_properties__plan0.xml +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_constant_properties__plan0.xml @@ -290,7 +290,7 @@ - + @@ -813,7 +813,7 @@ - + diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_no_group_by__plan0.xml b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_no_group_by__plan0.xml index 8ac0024a40..60fbf4b0f4 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_no_group_by__plan0.xml +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_no_group_by__plan0.xml @@ -242,7 +242,7 @@ - + @@ -697,7 +697,7 @@ - + diff --git a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_window__plan0.xml b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_window__plan0.xml index aa50779402..e4c825e0bb 100644 --- a/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_window__plan0.xml +++ b/tests_metricflow/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_window__plan0.xml @@ -290,7 +290,7 @@ - + @@ -801,7 +801,7 @@ - + diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multi_semantic_model_ratio_metrics_plan__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multi_semantic_model_ratio_metrics_plan__dfp_0.xml index 4f2fe013fa..1b05350e56 100644 --- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multi_semantic_model_ratio_metrics_plan__dfp_0.xml +++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multi_semantic_model_ratio_metrics_plan__dfp_0.xml @@ -115,7 +115,7 @@ - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml index f9aa2ddda0..159530b266 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml @@ -2183,7 +2183,7 @@ - + diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_sub_daily_dimension__plan0.sql index eb3bf092ab..2752c1396c 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_sub_daily_dimension__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_sub_daily_dimension__plan0.sql @@ -4,7 +4,8 @@ SELECT FROM ( -- Read Elements From Semantic Model 'users_ds_source' SELECT - DATETIME_TRUNC(users_ds_source_src_28000.ds, day) AS ds__day + 1 AS new_users + , DATETIME_TRUNC(users_ds_source_src_28000.ds, day) AS ds__day , DATETIME_TRUNC(users_ds_source_src_28000.ds, isoweek) AS ds__week , DATETIME_TRUNC(users_ds_source_src_28000.ds, month) AS ds__month , DATETIME_TRUNC(users_ds_source_src_28000.ds, quarter) AS ds__quarter diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_sub_daily_dimension__plan0.sql index 068fffb79b..01d34c71b7 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_sub_daily_dimension__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_sub_daily_dimension__plan0.sql @@ -4,7 +4,8 @@ SELECT FROM ( -- Read Elements From Semantic Model 'users_ds_source' SELECT - DATE_TRUNC('day', users_ds_source_src_28000.ds) AS ds__day + 1 AS new_users + , 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 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_sub_daily_dimension__plan0.sql index 32c180b9bb..4784321669 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_sub_daily_dimension__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_sub_daily_dimension__plan0.sql @@ -4,7 +4,8 @@ SELECT FROM ( -- Read Elements From Semantic Model 'users_ds_source' SELECT - DATE_TRUNC('day', users_ds_source_src_28000.ds) AS ds__day + 1 AS new_users + , 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 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_sub_daily_dimension__plan0.sql index 32c180b9bb..4784321669 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_sub_daily_dimension__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_sub_daily_dimension__plan0.sql @@ -4,7 +4,8 @@ SELECT FROM ( -- Read Elements From Semantic Model 'users_ds_source' SELECT - DATE_TRUNC('day', users_ds_source_src_28000.ds) AS ds__day + 1 AS new_users + , 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 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_sub_daily_dimension__plan0.sql index eb3225eb70..e420ab9005 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_sub_daily_dimension__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_sub_daily_dimension__plan0.sql @@ -4,7 +4,8 @@ SELECT FROM ( -- Read Elements From Semantic Model 'users_ds_source' SELECT - DATE_TRUNC('day', users_ds_source_src_28000.ds) AS ds__day + 1 AS new_users + , 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 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_sub_daily_dimension__plan0.sql index f10e223545..c743b8ab7f 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_sub_daily_dimension__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_sub_daily_dimension__plan0.sql @@ -4,7 +4,8 @@ SELECT FROM ( -- Read Elements From Semantic Model 'users_ds_source' SELECT - DATE_TRUNC('day', users_ds_source_src_28000.ds) AS ds__day + 1 AS new_users + , 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 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_sub_daily_dimension__plan0.sql index 32ff8427db..b7a93f6d5a 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_sub_daily_dimension__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_sub_daily_dimension__plan0.sql @@ -4,7 +4,8 @@ SELECT FROM ( -- Read Elements From Semantic Model 'users_ds_source' SELECT - DATE_TRUNC('day', users_ds_source_src_28000.ds) AS ds__day + 1 AS new_users + , 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 diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_conversion_metric_predicate_pushdown__dfp_0.xml b/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_conversion_metric_predicate_pushdown__dfp_0.xml index 63b4cfcd0a..a8488b82d8 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_conversion_metric_predicate_pushdown__dfp_0.xml +++ b/tests_metricflow/snapshots/test_predicate_pushdown_optimizer.py/DataflowPlan/test_conversion_metric_predicate_pushdown__dfp_0.xml @@ -153,7 +153,7 @@ - + @@ -257,7 +257,7 @@ - + diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0.sql index ddb20104bb..7b94b46885 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0.sql @@ -1,24 +1,24 @@ -- Compute Metrics via Expressions SELECT - subq_7.user__home_state - , subq_7.identity_verifications + subq_8.user__home_state + , subq_8.identity_verifications FROM ( -- Aggregate Measures SELECT - subq_6.user__home_state - , SUM(subq_6.identity_verifications) AS identity_verifications + subq_7.user__home_state + , SUM(subq_7.identity_verifications) AS identity_verifications FROM ( -- Pass Only Elements: ['identity_verifications', 'user__home_state'] SELECT - subq_5.user__home_state - , subq_5.identity_verifications + subq_6.user__home_state + , subq_6.identity_verifications FROM ( -- Join Standard Outputs SELECT subq_2.ds_partitioned__day AS ds_partitioned__day - , subq_4.ds_partitioned__day AS user__ds_partitioned__day + , subq_5.ds_partitioned__day AS user__ds_partitioned__day , subq_2.user AS user - , subq_4.home_state AS user__home_state + , subq_5.home_state AS user__home_state , subq_2.identity_verifications AS identity_verifications FROM ( -- Pass Only Elements: ['identity_verifications', 'ds_partitioned__day', 'user'] @@ -150,200 +150,394 @@ FROM ( LEFT OUTER JOIN ( -- Pass Only Elements: ['home_state', 'ds_partitioned__day', 'user'] SELECT - subq_3.ds_partitioned__day - , subq_3.user - , subq_3.home_state + subq_4.ds_partitioned__day + , subq_4.user + , subq_4.home_state FROM ( - -- Read Elements From Semantic Model 'users_ds_source' + -- Metric Time Dimension 'created_at' SELECT - DATETIME_TRUNC(users_ds_source_src_28000.ds, day) AS ds__day - , DATETIME_TRUNC(users_ds_source_src_28000.ds, isoweek) AS ds__week - , DATETIME_TRUNC(users_ds_source_src_28000.ds, month) AS ds__month - , DATETIME_TRUNC(users_ds_source_src_28000.ds, quarter) AS ds__quarter - , DATETIME_TRUNC(users_ds_source_src_28000.ds, year) 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 - , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.ds) - 1) AS ds__extract_dow - , EXTRACT(dayofyear FROM users_ds_source_src_28000.ds) AS ds__extract_doy - , DATETIME_TRUNC(users_ds_source_src_28000.created_at, day) AS created_at__day - , DATETIME_TRUNC(users_ds_source_src_28000.created_at, isoweek) AS created_at__week - , DATETIME_TRUNC(users_ds_source_src_28000.created_at, month) AS created_at__month - , DATETIME_TRUNC(users_ds_source_src_28000.created_at, quarter) AS created_at__quarter - , DATETIME_TRUNC(users_ds_source_src_28000.created_at, year) 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 - , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.created_at) - 1) AS created_at__extract_dow - , EXTRACT(dayofyear FROM users_ds_source_src_28000.created_at) AS created_at__extract_doy - , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, day) AS ds_partitioned__day - , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week - , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, month) AS ds_partitioned__month - , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter - , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, year) 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 - , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow - , EXTRACT(dayofyear FROM users_ds_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy - , users_ds_source_src_28000.home_state - , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, millisecond) AS last_profile_edit_ts__millisecond - , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, second) AS last_profile_edit_ts__second - , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, minute) AS last_profile_edit_ts__minute - , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, hour) AS last_profile_edit_ts__hour - , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, day) AS last_profile_edit_ts__day - , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, isoweek) AS last_profile_edit_ts__week - , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, month) AS last_profile_edit_ts__month - , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, quarter) AS last_profile_edit_ts__quarter - , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, year) 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 - , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.last_profile_edit_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.last_profile_edit_ts) - 1) AS last_profile_edit_ts__extract_dow - , EXTRACT(dayofyear FROM users_ds_source_src_28000.last_profile_edit_ts) AS last_profile_edit_ts__extract_doy - , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, second) AS bio_added_ts__second - , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, minute) AS bio_added_ts__minute - , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, hour) AS bio_added_ts__hour - , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, day) AS bio_added_ts__day - , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, isoweek) AS bio_added_ts__week - , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, month) AS bio_added_ts__month - , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, quarter) AS bio_added_ts__quarter - , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, year) 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 - , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.bio_added_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.bio_added_ts) - 1) AS bio_added_ts__extract_dow - , EXTRACT(dayofyear FROM users_ds_source_src_28000.bio_added_ts) AS bio_added_ts__extract_doy - , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, minute) AS last_login_ts__minute - , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, hour) AS last_login_ts__hour - , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, day) AS last_login_ts__day - , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, isoweek) AS last_login_ts__week - , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, month) AS last_login_ts__month - , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, quarter) AS last_login_ts__quarter - , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, year) 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 - , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.last_login_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.last_login_ts) - 1) AS last_login_ts__extract_dow - , EXTRACT(dayofyear FROM users_ds_source_src_28000.last_login_ts) AS last_login_ts__extract_doy - , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, hour) AS archived_at__hour - , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, day) AS archived_at__day - , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, isoweek) AS archived_at__week - , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, month) AS archived_at__month - , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, quarter) AS archived_at__quarter - , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, year) 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 - , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.archived_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.archived_at) - 1) AS archived_at__extract_dow - , EXTRACT(dayofyear FROM users_ds_source_src_28000.archived_at) AS archived_at__extract_doy - , DATETIME_TRUNC(users_ds_source_src_28000.ds, day) AS user__ds__day - , DATETIME_TRUNC(users_ds_source_src_28000.ds, isoweek) AS user__ds__week - , DATETIME_TRUNC(users_ds_source_src_28000.ds, month) AS user__ds__month - , DATETIME_TRUNC(users_ds_source_src_28000.ds, quarter) AS user__ds__quarter - , DATETIME_TRUNC(users_ds_source_src_28000.ds, year) 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 - , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.ds) - 1) AS user__ds__extract_dow - , EXTRACT(dayofyear FROM users_ds_source_src_28000.ds) AS user__ds__extract_doy - , DATETIME_TRUNC(users_ds_source_src_28000.created_at, day) AS user__created_at__day - , DATETIME_TRUNC(users_ds_source_src_28000.created_at, isoweek) AS user__created_at__week - , DATETIME_TRUNC(users_ds_source_src_28000.created_at, month) AS user__created_at__month - , DATETIME_TRUNC(users_ds_source_src_28000.created_at, quarter) AS user__created_at__quarter - , DATETIME_TRUNC(users_ds_source_src_28000.created_at, year) 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 - , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.created_at) - 1) AS user__created_at__extract_dow - , EXTRACT(dayofyear FROM users_ds_source_src_28000.created_at) AS user__created_at__extract_doy - , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, day) AS user__ds_partitioned__day - , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, isoweek) AS user__ds_partitioned__week - , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, month) AS user__ds_partitioned__month - , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, quarter) AS user__ds_partitioned__quarter - , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, year) 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 - , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.ds_partitioned) - 1) AS user__ds_partitioned__extract_dow - , EXTRACT(dayofyear 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 - , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, millisecond) AS user__last_profile_edit_ts__millisecond - , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, second) AS user__last_profile_edit_ts__second - , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, minute) AS user__last_profile_edit_ts__minute - , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, hour) AS user__last_profile_edit_ts__hour - , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, day) AS user__last_profile_edit_ts__day - , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, isoweek) AS user__last_profile_edit_ts__week - , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, month) AS user__last_profile_edit_ts__month - , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, quarter) AS user__last_profile_edit_ts__quarter - , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, year) 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 - , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.last_profile_edit_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.last_profile_edit_ts) - 1) AS user__last_profile_edit_ts__extract_dow - , EXTRACT(dayofyear FROM users_ds_source_src_28000.last_profile_edit_ts) AS user__last_profile_edit_ts__extract_doy - , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, second) AS user__bio_added_ts__second - , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, minute) AS user__bio_added_ts__minute - , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, hour) AS user__bio_added_ts__hour - , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, day) AS user__bio_added_ts__day - , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, isoweek) AS user__bio_added_ts__week - , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, month) AS user__bio_added_ts__month - , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, quarter) AS user__bio_added_ts__quarter - , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, year) 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 - , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.bio_added_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.bio_added_ts) - 1) AS user__bio_added_ts__extract_dow - , EXTRACT(dayofyear FROM users_ds_source_src_28000.bio_added_ts) AS user__bio_added_ts__extract_doy - , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, minute) AS user__last_login_ts__minute - , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, hour) AS user__last_login_ts__hour - , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, day) AS user__last_login_ts__day - , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, isoweek) AS user__last_login_ts__week - , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, month) AS user__last_login_ts__month - , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, quarter) AS user__last_login_ts__quarter - , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, year) 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 - , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.last_login_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.last_login_ts) - 1) AS user__last_login_ts__extract_dow - , EXTRACT(dayofyear FROM users_ds_source_src_28000.last_login_ts) AS user__last_login_ts__extract_doy - , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, hour) AS user__archived_at__hour - , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, day) AS user__archived_at__day - , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, isoweek) AS user__archived_at__week - , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, month) AS user__archived_at__month - , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, quarter) AS user__archived_at__quarter - , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, year) 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 - , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.archived_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.archived_at) - 1) AS user__archived_at__extract_dow - , EXTRACT(dayofyear 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_3 - ) subq_4 + subq_3.ds__day + , subq_3.ds__week + , subq_3.ds__month + , subq_3.ds__quarter + , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_day + , subq_3.ds__extract_dow + , subq_3.ds__extract_doy + , subq_3.created_at__day + , subq_3.created_at__week + , subq_3.created_at__month + , subq_3.created_at__quarter + , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy + , subq_3.ds_partitioned__day + , subq_3.ds_partitioned__week + , subq_3.ds_partitioned__month + , subq_3.ds_partitioned__quarter + , subq_3.ds_partitioned__year + , subq_3.ds_partitioned__extract_year + , subq_3.ds_partitioned__extract_quarter + , subq_3.ds_partitioned__extract_month + , subq_3.ds_partitioned__extract_day + , subq_3.ds_partitioned__extract_dow + , subq_3.ds_partitioned__extract_doy + , subq_3.last_profile_edit_ts__millisecond + , subq_3.last_profile_edit_ts__second + , subq_3.last_profile_edit_ts__minute + , subq_3.last_profile_edit_ts__hour + , subq_3.last_profile_edit_ts__day + , subq_3.last_profile_edit_ts__week + , subq_3.last_profile_edit_ts__month + , subq_3.last_profile_edit_ts__quarter + , subq_3.last_profile_edit_ts__year + , subq_3.last_profile_edit_ts__extract_year + , subq_3.last_profile_edit_ts__extract_quarter + , subq_3.last_profile_edit_ts__extract_month + , subq_3.last_profile_edit_ts__extract_day + , subq_3.last_profile_edit_ts__extract_dow + , subq_3.last_profile_edit_ts__extract_doy + , subq_3.bio_added_ts__second + , subq_3.bio_added_ts__minute + , subq_3.bio_added_ts__hour + , subq_3.bio_added_ts__day + , subq_3.bio_added_ts__week + , subq_3.bio_added_ts__month + , subq_3.bio_added_ts__quarter + , subq_3.bio_added_ts__year + , subq_3.bio_added_ts__extract_year + , subq_3.bio_added_ts__extract_quarter + , subq_3.bio_added_ts__extract_month + , subq_3.bio_added_ts__extract_day + , subq_3.bio_added_ts__extract_dow + , subq_3.bio_added_ts__extract_doy + , subq_3.last_login_ts__minute + , subq_3.last_login_ts__hour + , subq_3.last_login_ts__day + , subq_3.last_login_ts__week + , subq_3.last_login_ts__month + , subq_3.last_login_ts__quarter + , subq_3.last_login_ts__year + , subq_3.last_login_ts__extract_year + , subq_3.last_login_ts__extract_quarter + , subq_3.last_login_ts__extract_month + , subq_3.last_login_ts__extract_day + , subq_3.last_login_ts__extract_dow + , subq_3.last_login_ts__extract_doy + , subq_3.archived_at__hour + , subq_3.archived_at__day + , subq_3.archived_at__week + , subq_3.archived_at__month + , subq_3.archived_at__quarter + , subq_3.archived_at__year + , subq_3.archived_at__extract_year + , subq_3.archived_at__extract_quarter + , subq_3.archived_at__extract_month + , subq_3.archived_at__extract_day + , subq_3.archived_at__extract_dow + , subq_3.archived_at__extract_doy + , subq_3.user__ds__day + , subq_3.user__ds__week + , subq_3.user__ds__month + , subq_3.user__ds__quarter + , subq_3.user__ds__year + , subq_3.user__ds__extract_year + , subq_3.user__ds__extract_quarter + , subq_3.user__ds__extract_month + , subq_3.user__ds__extract_day + , subq_3.user__ds__extract_dow + , subq_3.user__ds__extract_doy + , subq_3.user__created_at__day + , subq_3.user__created_at__week + , subq_3.user__created_at__month + , subq_3.user__created_at__quarter + , subq_3.user__created_at__year + , subq_3.user__created_at__extract_year + , subq_3.user__created_at__extract_quarter + , subq_3.user__created_at__extract_month + , subq_3.user__created_at__extract_day + , subq_3.user__created_at__extract_dow + , subq_3.user__created_at__extract_doy + , subq_3.user__ds_partitioned__day + , subq_3.user__ds_partitioned__week + , subq_3.user__ds_partitioned__month + , subq_3.user__ds_partitioned__quarter + , subq_3.user__ds_partitioned__year + , subq_3.user__ds_partitioned__extract_year + , subq_3.user__ds_partitioned__extract_quarter + , subq_3.user__ds_partitioned__extract_month + , subq_3.user__ds_partitioned__extract_day + , subq_3.user__ds_partitioned__extract_dow + , subq_3.user__ds_partitioned__extract_doy + , subq_3.user__last_profile_edit_ts__millisecond + , subq_3.user__last_profile_edit_ts__second + , subq_3.user__last_profile_edit_ts__minute + , subq_3.user__last_profile_edit_ts__hour + , subq_3.user__last_profile_edit_ts__day + , subq_3.user__last_profile_edit_ts__week + , subq_3.user__last_profile_edit_ts__month + , subq_3.user__last_profile_edit_ts__quarter + , subq_3.user__last_profile_edit_ts__year + , subq_3.user__last_profile_edit_ts__extract_year + , subq_3.user__last_profile_edit_ts__extract_quarter + , subq_3.user__last_profile_edit_ts__extract_month + , subq_3.user__last_profile_edit_ts__extract_day + , subq_3.user__last_profile_edit_ts__extract_dow + , subq_3.user__last_profile_edit_ts__extract_doy + , subq_3.user__bio_added_ts__second + , subq_3.user__bio_added_ts__minute + , subq_3.user__bio_added_ts__hour + , subq_3.user__bio_added_ts__day + , subq_3.user__bio_added_ts__week + , subq_3.user__bio_added_ts__month + , subq_3.user__bio_added_ts__quarter + , subq_3.user__bio_added_ts__year + , subq_3.user__bio_added_ts__extract_year + , subq_3.user__bio_added_ts__extract_quarter + , subq_3.user__bio_added_ts__extract_month + , subq_3.user__bio_added_ts__extract_day + , subq_3.user__bio_added_ts__extract_dow + , subq_3.user__bio_added_ts__extract_doy + , subq_3.user__last_login_ts__minute + , subq_3.user__last_login_ts__hour + , subq_3.user__last_login_ts__day + , subq_3.user__last_login_ts__week + , subq_3.user__last_login_ts__month + , subq_3.user__last_login_ts__quarter + , subq_3.user__last_login_ts__year + , subq_3.user__last_login_ts__extract_year + , subq_3.user__last_login_ts__extract_quarter + , subq_3.user__last_login_ts__extract_month + , subq_3.user__last_login_ts__extract_day + , subq_3.user__last_login_ts__extract_dow + , subq_3.user__last_login_ts__extract_doy + , subq_3.user__archived_at__hour + , subq_3.user__archived_at__day + , subq_3.user__archived_at__week + , subq_3.user__archived_at__month + , subq_3.user__archived_at__quarter + , subq_3.user__archived_at__year + , subq_3.user__archived_at__extract_year + , subq_3.user__archived_at__extract_quarter + , subq_3.user__archived_at__extract_month + , subq_3.user__archived_at__extract_day + , subq_3.user__archived_at__extract_dow + , subq_3.user__archived_at__extract_doy + , subq_3.created_at__day AS metric_time__day + , subq_3.created_at__week AS metric_time__week + , subq_3.created_at__month AS metric_time__month + , subq_3.created_at__quarter AS metric_time__quarter + , subq_3.created_at__year AS metric_time__year + , subq_3.created_at__extract_year AS metric_time__extract_year + , subq_3.created_at__extract_quarter AS metric_time__extract_quarter + , subq_3.created_at__extract_month AS metric_time__extract_month + , subq_3.created_at__extract_day AS metric_time__extract_day + , subq_3.created_at__extract_dow AS metric_time__extract_dow + , subq_3.created_at__extract_doy AS metric_time__extract_doy + , subq_3.user + , subq_3.home_state + , subq_3.user__home_state + , subq_3.new_users + FROM ( + -- Read Elements From Semantic Model 'users_ds_source' + SELECT + 1 AS new_users + , DATETIME_TRUNC(users_ds_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(users_ds_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(users_ds_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(users_ds_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.ds, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.ds) AS ds__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.created_at) AS created_at__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy + , users_ds_source_src_28000.home_state + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, millisecond) AS last_profile_edit_ts__millisecond + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, second) AS last_profile_edit_ts__second + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, minute) AS last_profile_edit_ts__minute + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, hour) AS last_profile_edit_ts__hour + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, day) AS last_profile_edit_ts__day + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, isoweek) AS last_profile_edit_ts__week + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, month) AS last_profile_edit_ts__month + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, quarter) AS last_profile_edit_ts__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.last_profile_edit_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.last_profile_edit_ts) - 1) AS last_profile_edit_ts__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.last_profile_edit_ts) AS last_profile_edit_ts__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, second) AS bio_added_ts__second + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, minute) AS bio_added_ts__minute + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, hour) AS bio_added_ts__hour + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, day) AS bio_added_ts__day + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, isoweek) AS bio_added_ts__week + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, month) AS bio_added_ts__month + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, quarter) AS bio_added_ts__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.bio_added_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.bio_added_ts) - 1) AS bio_added_ts__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.bio_added_ts) AS bio_added_ts__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, minute) AS last_login_ts__minute + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, hour) AS last_login_ts__hour + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, day) AS last_login_ts__day + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, isoweek) AS last_login_ts__week + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, month) AS last_login_ts__month + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, quarter) AS last_login_ts__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.last_login_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.last_login_ts) - 1) AS last_login_ts__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.last_login_ts) AS last_login_ts__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, hour) AS archived_at__hour + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, day) AS archived_at__day + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, isoweek) AS archived_at__week + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, month) AS archived_at__month + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, quarter) AS archived_at__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.archived_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.archived_at) - 1) AS archived_at__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.archived_at) AS archived_at__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.ds, day) AS user__ds__day + , DATETIME_TRUNC(users_ds_source_src_28000.ds, isoweek) AS user__ds__week + , DATETIME_TRUNC(users_ds_source_src_28000.ds, month) AS user__ds__month + , DATETIME_TRUNC(users_ds_source_src_28000.ds, quarter) AS user__ds__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.ds, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.ds) - 1) AS user__ds__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.ds) AS user__ds__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, day) AS user__created_at__day + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, isoweek) AS user__created_at__week + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, month) AS user__created_at__month + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, quarter) AS user__created_at__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.created_at) - 1) AS user__created_at__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.created_at) AS user__created_at__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, day) AS user__ds_partitioned__day + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, isoweek) AS user__ds_partitioned__week + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, month) AS user__ds_partitioned__month + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, quarter) AS user__ds_partitioned__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.ds_partitioned) - 1) AS user__ds_partitioned__extract_dow + , EXTRACT(dayofyear 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 + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, millisecond) AS user__last_profile_edit_ts__millisecond + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, second) AS user__last_profile_edit_ts__second + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, minute) AS user__last_profile_edit_ts__minute + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, hour) AS user__last_profile_edit_ts__hour + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, day) AS user__last_profile_edit_ts__day + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, isoweek) AS user__last_profile_edit_ts__week + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, month) AS user__last_profile_edit_ts__month + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, quarter) AS user__last_profile_edit_ts__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.last_profile_edit_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.last_profile_edit_ts) - 1) AS user__last_profile_edit_ts__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.last_profile_edit_ts) AS user__last_profile_edit_ts__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, second) AS user__bio_added_ts__second + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, minute) AS user__bio_added_ts__minute + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, hour) AS user__bio_added_ts__hour + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, day) AS user__bio_added_ts__day + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, isoweek) AS user__bio_added_ts__week + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, month) AS user__bio_added_ts__month + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, quarter) AS user__bio_added_ts__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.bio_added_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.bio_added_ts) - 1) AS user__bio_added_ts__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.bio_added_ts) AS user__bio_added_ts__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, minute) AS user__last_login_ts__minute + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, hour) AS user__last_login_ts__hour + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, day) AS user__last_login_ts__day + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, isoweek) AS user__last_login_ts__week + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, month) AS user__last_login_ts__month + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, quarter) AS user__last_login_ts__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.last_login_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.last_login_ts) - 1) AS user__last_login_ts__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.last_login_ts) AS user__last_login_ts__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, hour) AS user__archived_at__hour + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, day) AS user__archived_at__day + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, isoweek) AS user__archived_at__week + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, month) AS user__archived_at__month + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, quarter) AS user__archived_at__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.archived_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.archived_at) - 1) AS user__archived_at__extract_dow + , EXTRACT(dayofyear 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_3 + ) subq_4 + ) subq_5 ON ( - subq_2.user = subq_4.user + subq_2.user = subq_5.user ) AND ( - subq_2.ds_partitioned__day = subq_4.ds_partitioned__day + subq_2.ds_partitioned__day = subq_5.ds_partitioned__day ) - ) subq_5 - ) subq_6 + ) subq_6 + ) subq_7 GROUP BY user__home_state -) subq_7 +) subq_8 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0_optimized.sql index 1aa07fc10f..c74a53fa6c 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_partitioned_join__plan0_optimized.sql @@ -4,7 +4,7 @@ -- Compute Metrics via Expressions SELECT users_ds_source_src_28000.home_state AS user__home_state - , SUM(subq_10.identity_verifications) AS identity_verifications + , SUM(subq_11.identity_verifications) AS identity_verifications FROM ( -- Read Elements From Semantic Model 'id_verifications' -- Metric Time Dimension 'ds' @@ -14,14 +14,14 @@ FROM ( , user_id AS user , 1 AS identity_verifications FROM ***************************.fct_id_verifications id_verifications_src_28000 -) subq_10 +) subq_11 LEFT OUTER JOIN ***************************.dim_users users_ds_source_src_28000 ON ( - subq_10.user = users_ds_source_src_28000.user_id + subq_11.user = users_ds_source_src_28000.user_id ) AND ( - subq_10.ds_partitioned__day = DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, day) + subq_11.ds_partitioned__day = DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, day) ) GROUP BY user__home_state diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_partitioned_join__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_partitioned_join__plan0.sql index 4067cd9e89..c9ffa81f2b 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_partitioned_join__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_partitioned_join__plan0.sql @@ -1,24 +1,24 @@ -- Compute Metrics via Expressions SELECT - subq_7.user__home_state - , subq_7.identity_verifications + subq_8.user__home_state + , subq_8.identity_verifications FROM ( -- Aggregate Measures SELECT - subq_6.user__home_state - , SUM(subq_6.identity_verifications) AS identity_verifications + subq_7.user__home_state + , SUM(subq_7.identity_verifications) AS identity_verifications FROM ( -- Pass Only Elements: ['identity_verifications', 'user__home_state'] SELECT - subq_5.user__home_state - , subq_5.identity_verifications + subq_6.user__home_state + , subq_6.identity_verifications FROM ( -- Join Standard Outputs SELECT subq_2.ds_partitioned__day AS ds_partitioned__day - , subq_4.ds_partitioned__day AS user__ds_partitioned__day + , subq_5.ds_partitioned__day AS user__ds_partitioned__day , subq_2.user AS user - , subq_4.home_state AS user__home_state + , subq_5.home_state AS user__home_state , subq_2.identity_verifications AS identity_verifications FROM ( -- Pass Only Elements: ['identity_verifications', 'ds_partitioned__day', 'user'] @@ -150,200 +150,394 @@ FROM ( LEFT OUTER JOIN ( -- Pass Only Elements: ['home_state', 'ds_partitioned__day', 'user'] SELECT - subq_3.ds_partitioned__day - , subq_3.user - , subq_3.home_state + subq_4.ds_partitioned__day + , subq_4.user + , subq_4.home_state FROM ( - -- Read Elements From Semantic Model 'users_ds_source' + -- Metric Time Dimension 'created_at' 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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_3 - ) subq_4 + subq_3.ds__day + , subq_3.ds__week + , subq_3.ds__month + , subq_3.ds__quarter + , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_day + , subq_3.ds__extract_dow + , subq_3.ds__extract_doy + , subq_3.created_at__day + , subq_3.created_at__week + , subq_3.created_at__month + , subq_3.created_at__quarter + , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy + , subq_3.ds_partitioned__day + , subq_3.ds_partitioned__week + , subq_3.ds_partitioned__month + , subq_3.ds_partitioned__quarter + , subq_3.ds_partitioned__year + , subq_3.ds_partitioned__extract_year + , subq_3.ds_partitioned__extract_quarter + , subq_3.ds_partitioned__extract_month + , subq_3.ds_partitioned__extract_day + , subq_3.ds_partitioned__extract_dow + , subq_3.ds_partitioned__extract_doy + , subq_3.last_profile_edit_ts__millisecond + , subq_3.last_profile_edit_ts__second + , subq_3.last_profile_edit_ts__minute + , subq_3.last_profile_edit_ts__hour + , subq_3.last_profile_edit_ts__day + , subq_3.last_profile_edit_ts__week + , subq_3.last_profile_edit_ts__month + , subq_3.last_profile_edit_ts__quarter + , subq_3.last_profile_edit_ts__year + , subq_3.last_profile_edit_ts__extract_year + , subq_3.last_profile_edit_ts__extract_quarter + , subq_3.last_profile_edit_ts__extract_month + , subq_3.last_profile_edit_ts__extract_day + , subq_3.last_profile_edit_ts__extract_dow + , subq_3.last_profile_edit_ts__extract_doy + , subq_3.bio_added_ts__second + , subq_3.bio_added_ts__minute + , subq_3.bio_added_ts__hour + , subq_3.bio_added_ts__day + , subq_3.bio_added_ts__week + , subq_3.bio_added_ts__month + , subq_3.bio_added_ts__quarter + , subq_3.bio_added_ts__year + , subq_3.bio_added_ts__extract_year + , subq_3.bio_added_ts__extract_quarter + , subq_3.bio_added_ts__extract_month + , subq_3.bio_added_ts__extract_day + , subq_3.bio_added_ts__extract_dow + , subq_3.bio_added_ts__extract_doy + , subq_3.last_login_ts__minute + , subq_3.last_login_ts__hour + , subq_3.last_login_ts__day + , subq_3.last_login_ts__week + , subq_3.last_login_ts__month + , subq_3.last_login_ts__quarter + , subq_3.last_login_ts__year + , subq_3.last_login_ts__extract_year + , subq_3.last_login_ts__extract_quarter + , subq_3.last_login_ts__extract_month + , subq_3.last_login_ts__extract_day + , subq_3.last_login_ts__extract_dow + , subq_3.last_login_ts__extract_doy + , subq_3.archived_at__hour + , subq_3.archived_at__day + , subq_3.archived_at__week + , subq_3.archived_at__month + , subq_3.archived_at__quarter + , subq_3.archived_at__year + , subq_3.archived_at__extract_year + , subq_3.archived_at__extract_quarter + , subq_3.archived_at__extract_month + , subq_3.archived_at__extract_day + , subq_3.archived_at__extract_dow + , subq_3.archived_at__extract_doy + , subq_3.user__ds__day + , subq_3.user__ds__week + , subq_3.user__ds__month + , subq_3.user__ds__quarter + , subq_3.user__ds__year + , subq_3.user__ds__extract_year + , subq_3.user__ds__extract_quarter + , subq_3.user__ds__extract_month + , subq_3.user__ds__extract_day + , subq_3.user__ds__extract_dow + , subq_3.user__ds__extract_doy + , subq_3.user__created_at__day + , subq_3.user__created_at__week + , subq_3.user__created_at__month + , subq_3.user__created_at__quarter + , subq_3.user__created_at__year + , subq_3.user__created_at__extract_year + , subq_3.user__created_at__extract_quarter + , subq_3.user__created_at__extract_month + , subq_3.user__created_at__extract_day + , subq_3.user__created_at__extract_dow + , subq_3.user__created_at__extract_doy + , subq_3.user__ds_partitioned__day + , subq_3.user__ds_partitioned__week + , subq_3.user__ds_partitioned__month + , subq_3.user__ds_partitioned__quarter + , subq_3.user__ds_partitioned__year + , subq_3.user__ds_partitioned__extract_year + , subq_3.user__ds_partitioned__extract_quarter + , subq_3.user__ds_partitioned__extract_month + , subq_3.user__ds_partitioned__extract_day + , subq_3.user__ds_partitioned__extract_dow + , subq_3.user__ds_partitioned__extract_doy + , subq_3.user__last_profile_edit_ts__millisecond + , subq_3.user__last_profile_edit_ts__second + , subq_3.user__last_profile_edit_ts__minute + , subq_3.user__last_profile_edit_ts__hour + , subq_3.user__last_profile_edit_ts__day + , subq_3.user__last_profile_edit_ts__week + , subq_3.user__last_profile_edit_ts__month + , subq_3.user__last_profile_edit_ts__quarter + , subq_3.user__last_profile_edit_ts__year + , subq_3.user__last_profile_edit_ts__extract_year + , subq_3.user__last_profile_edit_ts__extract_quarter + , subq_3.user__last_profile_edit_ts__extract_month + , subq_3.user__last_profile_edit_ts__extract_day + , subq_3.user__last_profile_edit_ts__extract_dow + , subq_3.user__last_profile_edit_ts__extract_doy + , subq_3.user__bio_added_ts__second + , subq_3.user__bio_added_ts__minute + , subq_3.user__bio_added_ts__hour + , subq_3.user__bio_added_ts__day + , subq_3.user__bio_added_ts__week + , subq_3.user__bio_added_ts__month + , subq_3.user__bio_added_ts__quarter + , subq_3.user__bio_added_ts__year + , subq_3.user__bio_added_ts__extract_year + , subq_3.user__bio_added_ts__extract_quarter + , subq_3.user__bio_added_ts__extract_month + , subq_3.user__bio_added_ts__extract_day + , subq_3.user__bio_added_ts__extract_dow + , subq_3.user__bio_added_ts__extract_doy + , subq_3.user__last_login_ts__minute + , subq_3.user__last_login_ts__hour + , subq_3.user__last_login_ts__day + , subq_3.user__last_login_ts__week + , subq_3.user__last_login_ts__month + , subq_3.user__last_login_ts__quarter + , subq_3.user__last_login_ts__year + , subq_3.user__last_login_ts__extract_year + , subq_3.user__last_login_ts__extract_quarter + , subq_3.user__last_login_ts__extract_month + , subq_3.user__last_login_ts__extract_day + , subq_3.user__last_login_ts__extract_dow + , subq_3.user__last_login_ts__extract_doy + , subq_3.user__archived_at__hour + , subq_3.user__archived_at__day + , subq_3.user__archived_at__week + , subq_3.user__archived_at__month + , subq_3.user__archived_at__quarter + , subq_3.user__archived_at__year + , subq_3.user__archived_at__extract_year + , subq_3.user__archived_at__extract_quarter + , subq_3.user__archived_at__extract_month + , subq_3.user__archived_at__extract_day + , subq_3.user__archived_at__extract_dow + , subq_3.user__archived_at__extract_doy + , subq_3.created_at__day AS metric_time__day + , subq_3.created_at__week AS metric_time__week + , subq_3.created_at__month AS metric_time__month + , subq_3.created_at__quarter AS metric_time__quarter + , subq_3.created_at__year AS metric_time__year + , subq_3.created_at__extract_year AS metric_time__extract_year + , subq_3.created_at__extract_quarter AS metric_time__extract_quarter + , subq_3.created_at__extract_month AS metric_time__extract_month + , subq_3.created_at__extract_day AS metric_time__extract_day + , subq_3.created_at__extract_dow AS metric_time__extract_dow + , subq_3.created_at__extract_doy AS metric_time__extract_doy + , subq_3.user + , subq_3.home_state + , subq_3.user__home_state + , subq_3.new_users + FROM ( + -- Read Elements From Semantic Model 'users_ds_source' + SELECT + 1 AS new_users + , 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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_3 + ) subq_4 + ) subq_5 ON ( - subq_2.user = subq_4.user + subq_2.user = subq_5.user ) AND ( - subq_2.ds_partitioned__day = subq_4.ds_partitioned__day + subq_2.ds_partitioned__day = subq_5.ds_partitioned__day ) - ) subq_5 - ) subq_6 + ) subq_6 + ) subq_7 GROUP BY - subq_6.user__home_state -) subq_7 + subq_7.user__home_state +) subq_8 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_partitioned_join__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_partitioned_join__plan0_optimized.sql index ec2ef7f9fa..be2da473cc 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_partitioned_join__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_partitioned_join__plan0_optimized.sql @@ -4,7 +4,7 @@ -- Compute Metrics via Expressions SELECT users_ds_source_src_28000.home_state AS user__home_state - , SUM(subq_10.identity_verifications) AS identity_verifications + , SUM(subq_11.identity_verifications) AS identity_verifications FROM ( -- Read Elements From Semantic Model 'id_verifications' -- Metric Time Dimension 'ds' @@ -14,14 +14,14 @@ FROM ( , user_id AS user , 1 AS identity_verifications FROM ***************************.fct_id_verifications id_verifications_src_28000 -) subq_10 +) subq_11 LEFT OUTER JOIN ***************************.dim_users users_ds_source_src_28000 ON ( - subq_10.user = users_ds_source_src_28000.user_id + subq_11.user = users_ds_source_src_28000.user_id ) AND ( - subq_10.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_28000.ds_partitioned) + subq_11.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_28000.ds_partitioned) ) GROUP BY users_ds_source_src_28000.home_state diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0.sql index 2c6261d271..11f19b0691 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0.sql @@ -1,24 +1,24 @@ -- Compute Metrics via Expressions SELECT - subq_7.user__home_state - , subq_7.identity_verifications + subq_8.user__home_state + , subq_8.identity_verifications FROM ( -- Aggregate Measures SELECT - subq_6.user__home_state - , SUM(subq_6.identity_verifications) AS identity_verifications + subq_7.user__home_state + , SUM(subq_7.identity_verifications) AS identity_verifications FROM ( -- Pass Only Elements: ['identity_verifications', 'user__home_state'] SELECT - subq_5.user__home_state - , subq_5.identity_verifications + subq_6.user__home_state + , subq_6.identity_verifications FROM ( -- Join Standard Outputs SELECT subq_2.ds_partitioned__day AS ds_partitioned__day - , subq_4.ds_partitioned__day AS user__ds_partitioned__day + , subq_5.ds_partitioned__day AS user__ds_partitioned__day , subq_2.user AS user - , subq_4.home_state AS user__home_state + , subq_5.home_state AS user__home_state , subq_2.identity_verifications AS identity_verifications FROM ( -- Pass Only Elements: ['identity_verifications', 'ds_partitioned__day', 'user'] @@ -150,200 +150,394 @@ FROM ( LEFT OUTER JOIN ( -- Pass Only Elements: ['home_state', 'ds_partitioned__day', 'user'] SELECT - subq_3.ds_partitioned__day - , subq_3.user - , subq_3.home_state + subq_4.ds_partitioned__day + , subq_4.user + , subq_4.home_state FROM ( - -- Read Elements From Semantic Model 'users_ds_source' + -- Metric Time Dimension 'created_at' 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_3 - ) subq_4 + subq_3.ds__day + , subq_3.ds__week + , subq_3.ds__month + , subq_3.ds__quarter + , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_day + , subq_3.ds__extract_dow + , subq_3.ds__extract_doy + , subq_3.created_at__day + , subq_3.created_at__week + , subq_3.created_at__month + , subq_3.created_at__quarter + , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy + , subq_3.ds_partitioned__day + , subq_3.ds_partitioned__week + , subq_3.ds_partitioned__month + , subq_3.ds_partitioned__quarter + , subq_3.ds_partitioned__year + , subq_3.ds_partitioned__extract_year + , subq_3.ds_partitioned__extract_quarter + , subq_3.ds_partitioned__extract_month + , subq_3.ds_partitioned__extract_day + , subq_3.ds_partitioned__extract_dow + , subq_3.ds_partitioned__extract_doy + , subq_3.last_profile_edit_ts__millisecond + , subq_3.last_profile_edit_ts__second + , subq_3.last_profile_edit_ts__minute + , subq_3.last_profile_edit_ts__hour + , subq_3.last_profile_edit_ts__day + , subq_3.last_profile_edit_ts__week + , subq_3.last_profile_edit_ts__month + , subq_3.last_profile_edit_ts__quarter + , subq_3.last_profile_edit_ts__year + , subq_3.last_profile_edit_ts__extract_year + , subq_3.last_profile_edit_ts__extract_quarter + , subq_3.last_profile_edit_ts__extract_month + , subq_3.last_profile_edit_ts__extract_day + , subq_3.last_profile_edit_ts__extract_dow + , subq_3.last_profile_edit_ts__extract_doy + , subq_3.bio_added_ts__second + , subq_3.bio_added_ts__minute + , subq_3.bio_added_ts__hour + , subq_3.bio_added_ts__day + , subq_3.bio_added_ts__week + , subq_3.bio_added_ts__month + , subq_3.bio_added_ts__quarter + , subq_3.bio_added_ts__year + , subq_3.bio_added_ts__extract_year + , subq_3.bio_added_ts__extract_quarter + , subq_3.bio_added_ts__extract_month + , subq_3.bio_added_ts__extract_day + , subq_3.bio_added_ts__extract_dow + , subq_3.bio_added_ts__extract_doy + , subq_3.last_login_ts__minute + , subq_3.last_login_ts__hour + , subq_3.last_login_ts__day + , subq_3.last_login_ts__week + , subq_3.last_login_ts__month + , subq_3.last_login_ts__quarter + , subq_3.last_login_ts__year + , subq_3.last_login_ts__extract_year + , subq_3.last_login_ts__extract_quarter + , subq_3.last_login_ts__extract_month + , subq_3.last_login_ts__extract_day + , subq_3.last_login_ts__extract_dow + , subq_3.last_login_ts__extract_doy + , subq_3.archived_at__hour + , subq_3.archived_at__day + , subq_3.archived_at__week + , subq_3.archived_at__month + , subq_3.archived_at__quarter + , subq_3.archived_at__year + , subq_3.archived_at__extract_year + , subq_3.archived_at__extract_quarter + , subq_3.archived_at__extract_month + , subq_3.archived_at__extract_day + , subq_3.archived_at__extract_dow + , subq_3.archived_at__extract_doy + , subq_3.user__ds__day + , subq_3.user__ds__week + , subq_3.user__ds__month + , subq_3.user__ds__quarter + , subq_3.user__ds__year + , subq_3.user__ds__extract_year + , subq_3.user__ds__extract_quarter + , subq_3.user__ds__extract_month + , subq_3.user__ds__extract_day + , subq_3.user__ds__extract_dow + , subq_3.user__ds__extract_doy + , subq_3.user__created_at__day + , subq_3.user__created_at__week + , subq_3.user__created_at__month + , subq_3.user__created_at__quarter + , subq_3.user__created_at__year + , subq_3.user__created_at__extract_year + , subq_3.user__created_at__extract_quarter + , subq_3.user__created_at__extract_month + , subq_3.user__created_at__extract_day + , subq_3.user__created_at__extract_dow + , subq_3.user__created_at__extract_doy + , subq_3.user__ds_partitioned__day + , subq_3.user__ds_partitioned__week + , subq_3.user__ds_partitioned__month + , subq_3.user__ds_partitioned__quarter + , subq_3.user__ds_partitioned__year + , subq_3.user__ds_partitioned__extract_year + , subq_3.user__ds_partitioned__extract_quarter + , subq_3.user__ds_partitioned__extract_month + , subq_3.user__ds_partitioned__extract_day + , subq_3.user__ds_partitioned__extract_dow + , subq_3.user__ds_partitioned__extract_doy + , subq_3.user__last_profile_edit_ts__millisecond + , subq_3.user__last_profile_edit_ts__second + , subq_3.user__last_profile_edit_ts__minute + , subq_3.user__last_profile_edit_ts__hour + , subq_3.user__last_profile_edit_ts__day + , subq_3.user__last_profile_edit_ts__week + , subq_3.user__last_profile_edit_ts__month + , subq_3.user__last_profile_edit_ts__quarter + , subq_3.user__last_profile_edit_ts__year + , subq_3.user__last_profile_edit_ts__extract_year + , subq_3.user__last_profile_edit_ts__extract_quarter + , subq_3.user__last_profile_edit_ts__extract_month + , subq_3.user__last_profile_edit_ts__extract_day + , subq_3.user__last_profile_edit_ts__extract_dow + , subq_3.user__last_profile_edit_ts__extract_doy + , subq_3.user__bio_added_ts__second + , subq_3.user__bio_added_ts__minute + , subq_3.user__bio_added_ts__hour + , subq_3.user__bio_added_ts__day + , subq_3.user__bio_added_ts__week + , subq_3.user__bio_added_ts__month + , subq_3.user__bio_added_ts__quarter + , subq_3.user__bio_added_ts__year + , subq_3.user__bio_added_ts__extract_year + , subq_3.user__bio_added_ts__extract_quarter + , subq_3.user__bio_added_ts__extract_month + , subq_3.user__bio_added_ts__extract_day + , subq_3.user__bio_added_ts__extract_dow + , subq_3.user__bio_added_ts__extract_doy + , subq_3.user__last_login_ts__minute + , subq_3.user__last_login_ts__hour + , subq_3.user__last_login_ts__day + , subq_3.user__last_login_ts__week + , subq_3.user__last_login_ts__month + , subq_3.user__last_login_ts__quarter + , subq_3.user__last_login_ts__year + , subq_3.user__last_login_ts__extract_year + , subq_3.user__last_login_ts__extract_quarter + , subq_3.user__last_login_ts__extract_month + , subq_3.user__last_login_ts__extract_day + , subq_3.user__last_login_ts__extract_dow + , subq_3.user__last_login_ts__extract_doy + , subq_3.user__archived_at__hour + , subq_3.user__archived_at__day + , subq_3.user__archived_at__week + , subq_3.user__archived_at__month + , subq_3.user__archived_at__quarter + , subq_3.user__archived_at__year + , subq_3.user__archived_at__extract_year + , subq_3.user__archived_at__extract_quarter + , subq_3.user__archived_at__extract_month + , subq_3.user__archived_at__extract_day + , subq_3.user__archived_at__extract_dow + , subq_3.user__archived_at__extract_doy + , subq_3.created_at__day AS metric_time__day + , subq_3.created_at__week AS metric_time__week + , subq_3.created_at__month AS metric_time__month + , subq_3.created_at__quarter AS metric_time__quarter + , subq_3.created_at__year AS metric_time__year + , subq_3.created_at__extract_year AS metric_time__extract_year + , subq_3.created_at__extract_quarter AS metric_time__extract_quarter + , subq_3.created_at__extract_month AS metric_time__extract_month + , subq_3.created_at__extract_day AS metric_time__extract_day + , subq_3.created_at__extract_dow AS metric_time__extract_dow + , subq_3.created_at__extract_doy AS metric_time__extract_doy + , subq_3.user + , subq_3.home_state + , subq_3.user__home_state + , subq_3.new_users + FROM ( + -- Read Elements From Semantic Model 'users_ds_source' + SELECT + 1 AS new_users + , 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_3 + ) subq_4 + ) subq_5 ON ( - subq_2.user = subq_4.user + subq_2.user = subq_5.user ) AND ( - subq_2.ds_partitioned__day = subq_4.ds_partitioned__day + subq_2.ds_partitioned__day = subq_5.ds_partitioned__day ) - ) subq_5 - ) subq_6 + ) subq_6 + ) subq_7 GROUP BY - subq_6.user__home_state -) subq_7 + subq_7.user__home_state +) subq_8 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0_optimized.sql index ec2ef7f9fa..be2da473cc 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0_optimized.sql @@ -4,7 +4,7 @@ -- Compute Metrics via Expressions SELECT users_ds_source_src_28000.home_state AS user__home_state - , SUM(subq_10.identity_verifications) AS identity_verifications + , SUM(subq_11.identity_verifications) AS identity_verifications FROM ( -- Read Elements From Semantic Model 'id_verifications' -- Metric Time Dimension 'ds' @@ -14,14 +14,14 @@ FROM ( , user_id AS user , 1 AS identity_verifications FROM ***************************.fct_id_verifications id_verifications_src_28000 -) subq_10 +) subq_11 LEFT OUTER JOIN ***************************.dim_users users_ds_source_src_28000 ON ( - subq_10.user = users_ds_source_src_28000.user_id + subq_11.user = users_ds_source_src_28000.user_id ) AND ( - subq_10.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_28000.ds_partitioned) + subq_11.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_28000.ds_partitioned) ) GROUP BY users_ds_source_src_28000.home_state diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_partitioned_join__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_partitioned_join__plan0.sql index 2c6261d271..11f19b0691 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_partitioned_join__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_partitioned_join__plan0.sql @@ -1,24 +1,24 @@ -- Compute Metrics via Expressions SELECT - subq_7.user__home_state - , subq_7.identity_verifications + subq_8.user__home_state + , subq_8.identity_verifications FROM ( -- Aggregate Measures SELECT - subq_6.user__home_state - , SUM(subq_6.identity_verifications) AS identity_verifications + subq_7.user__home_state + , SUM(subq_7.identity_verifications) AS identity_verifications FROM ( -- Pass Only Elements: ['identity_verifications', 'user__home_state'] SELECT - subq_5.user__home_state - , subq_5.identity_verifications + subq_6.user__home_state + , subq_6.identity_verifications FROM ( -- Join Standard Outputs SELECT subq_2.ds_partitioned__day AS ds_partitioned__day - , subq_4.ds_partitioned__day AS user__ds_partitioned__day + , subq_5.ds_partitioned__day AS user__ds_partitioned__day , subq_2.user AS user - , subq_4.home_state AS user__home_state + , subq_5.home_state AS user__home_state , subq_2.identity_verifications AS identity_verifications FROM ( -- Pass Only Elements: ['identity_verifications', 'ds_partitioned__day', 'user'] @@ -150,200 +150,394 @@ FROM ( LEFT OUTER JOIN ( -- Pass Only Elements: ['home_state', 'ds_partitioned__day', 'user'] SELECT - subq_3.ds_partitioned__day - , subq_3.user - , subq_3.home_state + subq_4.ds_partitioned__day + , subq_4.user + , subq_4.home_state FROM ( - -- Read Elements From Semantic Model 'users_ds_source' + -- Metric Time Dimension 'created_at' 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_3 - ) subq_4 + subq_3.ds__day + , subq_3.ds__week + , subq_3.ds__month + , subq_3.ds__quarter + , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_day + , subq_3.ds__extract_dow + , subq_3.ds__extract_doy + , subq_3.created_at__day + , subq_3.created_at__week + , subq_3.created_at__month + , subq_3.created_at__quarter + , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy + , subq_3.ds_partitioned__day + , subq_3.ds_partitioned__week + , subq_3.ds_partitioned__month + , subq_3.ds_partitioned__quarter + , subq_3.ds_partitioned__year + , subq_3.ds_partitioned__extract_year + , subq_3.ds_partitioned__extract_quarter + , subq_3.ds_partitioned__extract_month + , subq_3.ds_partitioned__extract_day + , subq_3.ds_partitioned__extract_dow + , subq_3.ds_partitioned__extract_doy + , subq_3.last_profile_edit_ts__millisecond + , subq_3.last_profile_edit_ts__second + , subq_3.last_profile_edit_ts__minute + , subq_3.last_profile_edit_ts__hour + , subq_3.last_profile_edit_ts__day + , subq_3.last_profile_edit_ts__week + , subq_3.last_profile_edit_ts__month + , subq_3.last_profile_edit_ts__quarter + , subq_3.last_profile_edit_ts__year + , subq_3.last_profile_edit_ts__extract_year + , subq_3.last_profile_edit_ts__extract_quarter + , subq_3.last_profile_edit_ts__extract_month + , subq_3.last_profile_edit_ts__extract_day + , subq_3.last_profile_edit_ts__extract_dow + , subq_3.last_profile_edit_ts__extract_doy + , subq_3.bio_added_ts__second + , subq_3.bio_added_ts__minute + , subq_3.bio_added_ts__hour + , subq_3.bio_added_ts__day + , subq_3.bio_added_ts__week + , subq_3.bio_added_ts__month + , subq_3.bio_added_ts__quarter + , subq_3.bio_added_ts__year + , subq_3.bio_added_ts__extract_year + , subq_3.bio_added_ts__extract_quarter + , subq_3.bio_added_ts__extract_month + , subq_3.bio_added_ts__extract_day + , subq_3.bio_added_ts__extract_dow + , subq_3.bio_added_ts__extract_doy + , subq_3.last_login_ts__minute + , subq_3.last_login_ts__hour + , subq_3.last_login_ts__day + , subq_3.last_login_ts__week + , subq_3.last_login_ts__month + , subq_3.last_login_ts__quarter + , subq_3.last_login_ts__year + , subq_3.last_login_ts__extract_year + , subq_3.last_login_ts__extract_quarter + , subq_3.last_login_ts__extract_month + , subq_3.last_login_ts__extract_day + , subq_3.last_login_ts__extract_dow + , subq_3.last_login_ts__extract_doy + , subq_3.archived_at__hour + , subq_3.archived_at__day + , subq_3.archived_at__week + , subq_3.archived_at__month + , subq_3.archived_at__quarter + , subq_3.archived_at__year + , subq_3.archived_at__extract_year + , subq_3.archived_at__extract_quarter + , subq_3.archived_at__extract_month + , subq_3.archived_at__extract_day + , subq_3.archived_at__extract_dow + , subq_3.archived_at__extract_doy + , subq_3.user__ds__day + , subq_3.user__ds__week + , subq_3.user__ds__month + , subq_3.user__ds__quarter + , subq_3.user__ds__year + , subq_3.user__ds__extract_year + , subq_3.user__ds__extract_quarter + , subq_3.user__ds__extract_month + , subq_3.user__ds__extract_day + , subq_3.user__ds__extract_dow + , subq_3.user__ds__extract_doy + , subq_3.user__created_at__day + , subq_3.user__created_at__week + , subq_3.user__created_at__month + , subq_3.user__created_at__quarter + , subq_3.user__created_at__year + , subq_3.user__created_at__extract_year + , subq_3.user__created_at__extract_quarter + , subq_3.user__created_at__extract_month + , subq_3.user__created_at__extract_day + , subq_3.user__created_at__extract_dow + , subq_3.user__created_at__extract_doy + , subq_3.user__ds_partitioned__day + , subq_3.user__ds_partitioned__week + , subq_3.user__ds_partitioned__month + , subq_3.user__ds_partitioned__quarter + , subq_3.user__ds_partitioned__year + , subq_3.user__ds_partitioned__extract_year + , subq_3.user__ds_partitioned__extract_quarter + , subq_3.user__ds_partitioned__extract_month + , subq_3.user__ds_partitioned__extract_day + , subq_3.user__ds_partitioned__extract_dow + , subq_3.user__ds_partitioned__extract_doy + , subq_3.user__last_profile_edit_ts__millisecond + , subq_3.user__last_profile_edit_ts__second + , subq_3.user__last_profile_edit_ts__minute + , subq_3.user__last_profile_edit_ts__hour + , subq_3.user__last_profile_edit_ts__day + , subq_3.user__last_profile_edit_ts__week + , subq_3.user__last_profile_edit_ts__month + , subq_3.user__last_profile_edit_ts__quarter + , subq_3.user__last_profile_edit_ts__year + , subq_3.user__last_profile_edit_ts__extract_year + , subq_3.user__last_profile_edit_ts__extract_quarter + , subq_3.user__last_profile_edit_ts__extract_month + , subq_3.user__last_profile_edit_ts__extract_day + , subq_3.user__last_profile_edit_ts__extract_dow + , subq_3.user__last_profile_edit_ts__extract_doy + , subq_3.user__bio_added_ts__second + , subq_3.user__bio_added_ts__minute + , subq_3.user__bio_added_ts__hour + , subq_3.user__bio_added_ts__day + , subq_3.user__bio_added_ts__week + , subq_3.user__bio_added_ts__month + , subq_3.user__bio_added_ts__quarter + , subq_3.user__bio_added_ts__year + , subq_3.user__bio_added_ts__extract_year + , subq_3.user__bio_added_ts__extract_quarter + , subq_3.user__bio_added_ts__extract_month + , subq_3.user__bio_added_ts__extract_day + , subq_3.user__bio_added_ts__extract_dow + , subq_3.user__bio_added_ts__extract_doy + , subq_3.user__last_login_ts__minute + , subq_3.user__last_login_ts__hour + , subq_3.user__last_login_ts__day + , subq_3.user__last_login_ts__week + , subq_3.user__last_login_ts__month + , subq_3.user__last_login_ts__quarter + , subq_3.user__last_login_ts__year + , subq_3.user__last_login_ts__extract_year + , subq_3.user__last_login_ts__extract_quarter + , subq_3.user__last_login_ts__extract_month + , subq_3.user__last_login_ts__extract_day + , subq_3.user__last_login_ts__extract_dow + , subq_3.user__last_login_ts__extract_doy + , subq_3.user__archived_at__hour + , subq_3.user__archived_at__day + , subq_3.user__archived_at__week + , subq_3.user__archived_at__month + , subq_3.user__archived_at__quarter + , subq_3.user__archived_at__year + , subq_3.user__archived_at__extract_year + , subq_3.user__archived_at__extract_quarter + , subq_3.user__archived_at__extract_month + , subq_3.user__archived_at__extract_day + , subq_3.user__archived_at__extract_dow + , subq_3.user__archived_at__extract_doy + , subq_3.created_at__day AS metric_time__day + , subq_3.created_at__week AS metric_time__week + , subq_3.created_at__month AS metric_time__month + , subq_3.created_at__quarter AS metric_time__quarter + , subq_3.created_at__year AS metric_time__year + , subq_3.created_at__extract_year AS metric_time__extract_year + , subq_3.created_at__extract_quarter AS metric_time__extract_quarter + , subq_3.created_at__extract_month AS metric_time__extract_month + , subq_3.created_at__extract_day AS metric_time__extract_day + , subq_3.created_at__extract_dow AS metric_time__extract_dow + , subq_3.created_at__extract_doy AS metric_time__extract_doy + , subq_3.user + , subq_3.home_state + , subq_3.user__home_state + , subq_3.new_users + FROM ( + -- Read Elements From Semantic Model 'users_ds_source' + SELECT + 1 AS new_users + , 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_3 + ) subq_4 + ) subq_5 ON ( - subq_2.user = subq_4.user + subq_2.user = subq_5.user ) AND ( - subq_2.ds_partitioned__day = subq_4.ds_partitioned__day + subq_2.ds_partitioned__day = subq_5.ds_partitioned__day ) - ) subq_5 - ) subq_6 + ) subq_6 + ) subq_7 GROUP BY - subq_6.user__home_state -) subq_7 + subq_7.user__home_state +) subq_8 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_partitioned_join__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_partitioned_join__plan0_optimized.sql index ec2ef7f9fa..be2da473cc 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_partitioned_join__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_partitioned_join__plan0_optimized.sql @@ -4,7 +4,7 @@ -- Compute Metrics via Expressions SELECT users_ds_source_src_28000.home_state AS user__home_state - , SUM(subq_10.identity_verifications) AS identity_verifications + , SUM(subq_11.identity_verifications) AS identity_verifications FROM ( -- Read Elements From Semantic Model 'id_verifications' -- Metric Time Dimension 'ds' @@ -14,14 +14,14 @@ FROM ( , user_id AS user , 1 AS identity_verifications FROM ***************************.fct_id_verifications id_verifications_src_28000 -) subq_10 +) subq_11 LEFT OUTER JOIN ***************************.dim_users users_ds_source_src_28000 ON ( - subq_10.user = users_ds_source_src_28000.user_id + subq_11.user = users_ds_source_src_28000.user_id ) AND ( - subq_10.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_28000.ds_partitioned) + subq_11.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_28000.ds_partitioned) ) GROUP BY users_ds_source_src_28000.home_state diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_partitioned_join__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_partitioned_join__plan0.sql index 2dd31cfb11..ab3ae405c0 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_partitioned_join__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_partitioned_join__plan0.sql @@ -1,24 +1,24 @@ -- Compute Metrics via Expressions SELECT - subq_7.user__home_state - , subq_7.identity_verifications + subq_8.user__home_state + , subq_8.identity_verifications FROM ( -- Aggregate Measures SELECT - subq_6.user__home_state - , SUM(subq_6.identity_verifications) AS identity_verifications + subq_7.user__home_state + , SUM(subq_7.identity_verifications) AS identity_verifications FROM ( -- Pass Only Elements: ['identity_verifications', 'user__home_state'] SELECT - subq_5.user__home_state - , subq_5.identity_verifications + subq_6.user__home_state + , subq_6.identity_verifications FROM ( -- Join Standard Outputs SELECT subq_2.ds_partitioned__day AS ds_partitioned__day - , subq_4.ds_partitioned__day AS user__ds_partitioned__day + , subq_5.ds_partitioned__day AS user__ds_partitioned__day , subq_2.user AS user - , subq_4.home_state AS user__home_state + , subq_5.home_state AS user__home_state , subq_2.identity_verifications AS identity_verifications FROM ( -- Pass Only Elements: ['identity_verifications', 'ds_partitioned__day', 'user'] @@ -150,200 +150,394 @@ FROM ( LEFT OUTER JOIN ( -- Pass Only Elements: ['home_state', 'ds_partitioned__day', 'user'] SELECT - subq_3.ds_partitioned__day - , subq_3.user - , subq_3.home_state + subq_4.ds_partitioned__day + , subq_4.user + , subq_4.home_state FROM ( - -- Read Elements From Semantic Model 'users_ds_source' + -- Metric Time Dimension 'created_at' 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 - , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.ds) END 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 - , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.created_at) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.created_at) END 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 - , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) END 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 - , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) END 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 - , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) END 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 - , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) END 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 - , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.archived_at) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.archived_at) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.archived_at) END 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 - , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.ds) END 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 - , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.created_at) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.created_at) END 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 - , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) END 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 - , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) END 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 - , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) END 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 - , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) END 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 - , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.archived_at) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.archived_at) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.archived_at) END 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_3 - ) subq_4 + subq_3.ds__day + , subq_3.ds__week + , subq_3.ds__month + , subq_3.ds__quarter + , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_day + , subq_3.ds__extract_dow + , subq_3.ds__extract_doy + , subq_3.created_at__day + , subq_3.created_at__week + , subq_3.created_at__month + , subq_3.created_at__quarter + , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy + , subq_3.ds_partitioned__day + , subq_3.ds_partitioned__week + , subq_3.ds_partitioned__month + , subq_3.ds_partitioned__quarter + , subq_3.ds_partitioned__year + , subq_3.ds_partitioned__extract_year + , subq_3.ds_partitioned__extract_quarter + , subq_3.ds_partitioned__extract_month + , subq_3.ds_partitioned__extract_day + , subq_3.ds_partitioned__extract_dow + , subq_3.ds_partitioned__extract_doy + , subq_3.last_profile_edit_ts__millisecond + , subq_3.last_profile_edit_ts__second + , subq_3.last_profile_edit_ts__minute + , subq_3.last_profile_edit_ts__hour + , subq_3.last_profile_edit_ts__day + , subq_3.last_profile_edit_ts__week + , subq_3.last_profile_edit_ts__month + , subq_3.last_profile_edit_ts__quarter + , subq_3.last_profile_edit_ts__year + , subq_3.last_profile_edit_ts__extract_year + , subq_3.last_profile_edit_ts__extract_quarter + , subq_3.last_profile_edit_ts__extract_month + , subq_3.last_profile_edit_ts__extract_day + , subq_3.last_profile_edit_ts__extract_dow + , subq_3.last_profile_edit_ts__extract_doy + , subq_3.bio_added_ts__second + , subq_3.bio_added_ts__minute + , subq_3.bio_added_ts__hour + , subq_3.bio_added_ts__day + , subq_3.bio_added_ts__week + , subq_3.bio_added_ts__month + , subq_3.bio_added_ts__quarter + , subq_3.bio_added_ts__year + , subq_3.bio_added_ts__extract_year + , subq_3.bio_added_ts__extract_quarter + , subq_3.bio_added_ts__extract_month + , subq_3.bio_added_ts__extract_day + , subq_3.bio_added_ts__extract_dow + , subq_3.bio_added_ts__extract_doy + , subq_3.last_login_ts__minute + , subq_3.last_login_ts__hour + , subq_3.last_login_ts__day + , subq_3.last_login_ts__week + , subq_3.last_login_ts__month + , subq_3.last_login_ts__quarter + , subq_3.last_login_ts__year + , subq_3.last_login_ts__extract_year + , subq_3.last_login_ts__extract_quarter + , subq_3.last_login_ts__extract_month + , subq_3.last_login_ts__extract_day + , subq_3.last_login_ts__extract_dow + , subq_3.last_login_ts__extract_doy + , subq_3.archived_at__hour + , subq_3.archived_at__day + , subq_3.archived_at__week + , subq_3.archived_at__month + , subq_3.archived_at__quarter + , subq_3.archived_at__year + , subq_3.archived_at__extract_year + , subq_3.archived_at__extract_quarter + , subq_3.archived_at__extract_month + , subq_3.archived_at__extract_day + , subq_3.archived_at__extract_dow + , subq_3.archived_at__extract_doy + , subq_3.user__ds__day + , subq_3.user__ds__week + , subq_3.user__ds__month + , subq_3.user__ds__quarter + , subq_3.user__ds__year + , subq_3.user__ds__extract_year + , subq_3.user__ds__extract_quarter + , subq_3.user__ds__extract_month + , subq_3.user__ds__extract_day + , subq_3.user__ds__extract_dow + , subq_3.user__ds__extract_doy + , subq_3.user__created_at__day + , subq_3.user__created_at__week + , subq_3.user__created_at__month + , subq_3.user__created_at__quarter + , subq_3.user__created_at__year + , subq_3.user__created_at__extract_year + , subq_3.user__created_at__extract_quarter + , subq_3.user__created_at__extract_month + , subq_3.user__created_at__extract_day + , subq_3.user__created_at__extract_dow + , subq_3.user__created_at__extract_doy + , subq_3.user__ds_partitioned__day + , subq_3.user__ds_partitioned__week + , subq_3.user__ds_partitioned__month + , subq_3.user__ds_partitioned__quarter + , subq_3.user__ds_partitioned__year + , subq_3.user__ds_partitioned__extract_year + , subq_3.user__ds_partitioned__extract_quarter + , subq_3.user__ds_partitioned__extract_month + , subq_3.user__ds_partitioned__extract_day + , subq_3.user__ds_partitioned__extract_dow + , subq_3.user__ds_partitioned__extract_doy + , subq_3.user__last_profile_edit_ts__millisecond + , subq_3.user__last_profile_edit_ts__second + , subq_3.user__last_profile_edit_ts__minute + , subq_3.user__last_profile_edit_ts__hour + , subq_3.user__last_profile_edit_ts__day + , subq_3.user__last_profile_edit_ts__week + , subq_3.user__last_profile_edit_ts__month + , subq_3.user__last_profile_edit_ts__quarter + , subq_3.user__last_profile_edit_ts__year + , subq_3.user__last_profile_edit_ts__extract_year + , subq_3.user__last_profile_edit_ts__extract_quarter + , subq_3.user__last_profile_edit_ts__extract_month + , subq_3.user__last_profile_edit_ts__extract_day + , subq_3.user__last_profile_edit_ts__extract_dow + , subq_3.user__last_profile_edit_ts__extract_doy + , subq_3.user__bio_added_ts__second + , subq_3.user__bio_added_ts__minute + , subq_3.user__bio_added_ts__hour + , subq_3.user__bio_added_ts__day + , subq_3.user__bio_added_ts__week + , subq_3.user__bio_added_ts__month + , subq_3.user__bio_added_ts__quarter + , subq_3.user__bio_added_ts__year + , subq_3.user__bio_added_ts__extract_year + , subq_3.user__bio_added_ts__extract_quarter + , subq_3.user__bio_added_ts__extract_month + , subq_3.user__bio_added_ts__extract_day + , subq_3.user__bio_added_ts__extract_dow + , subq_3.user__bio_added_ts__extract_doy + , subq_3.user__last_login_ts__minute + , subq_3.user__last_login_ts__hour + , subq_3.user__last_login_ts__day + , subq_3.user__last_login_ts__week + , subq_3.user__last_login_ts__month + , subq_3.user__last_login_ts__quarter + , subq_3.user__last_login_ts__year + , subq_3.user__last_login_ts__extract_year + , subq_3.user__last_login_ts__extract_quarter + , subq_3.user__last_login_ts__extract_month + , subq_3.user__last_login_ts__extract_day + , subq_3.user__last_login_ts__extract_dow + , subq_3.user__last_login_ts__extract_doy + , subq_3.user__archived_at__hour + , subq_3.user__archived_at__day + , subq_3.user__archived_at__week + , subq_3.user__archived_at__month + , subq_3.user__archived_at__quarter + , subq_3.user__archived_at__year + , subq_3.user__archived_at__extract_year + , subq_3.user__archived_at__extract_quarter + , subq_3.user__archived_at__extract_month + , subq_3.user__archived_at__extract_day + , subq_3.user__archived_at__extract_dow + , subq_3.user__archived_at__extract_doy + , subq_3.created_at__day AS metric_time__day + , subq_3.created_at__week AS metric_time__week + , subq_3.created_at__month AS metric_time__month + , subq_3.created_at__quarter AS metric_time__quarter + , subq_3.created_at__year AS metric_time__year + , subq_3.created_at__extract_year AS metric_time__extract_year + , subq_3.created_at__extract_quarter AS metric_time__extract_quarter + , subq_3.created_at__extract_month AS metric_time__extract_month + , subq_3.created_at__extract_day AS metric_time__extract_day + , subq_3.created_at__extract_dow AS metric_time__extract_dow + , subq_3.created_at__extract_doy AS metric_time__extract_doy + , subq_3.user + , subq_3.home_state + , subq_3.user__home_state + , subq_3.new_users + FROM ( + -- Read Elements From Semantic Model 'users_ds_source' + SELECT + 1 AS new_users + , 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.ds) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.created_at) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.created_at) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.archived_at) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.archived_at) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.archived_at) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.ds) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.created_at) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.created_at) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.archived_at) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.archived_at) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.archived_at) END 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_3 + ) subq_4 + ) subq_5 ON ( - subq_2.user = subq_4.user + subq_2.user = subq_5.user ) AND ( - subq_2.ds_partitioned__day = subq_4.ds_partitioned__day + subq_2.ds_partitioned__day = subq_5.ds_partitioned__day ) - ) subq_5 - ) subq_6 + ) subq_6 + ) subq_7 GROUP BY - subq_6.user__home_state -) subq_7 + subq_7.user__home_state +) subq_8 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_partitioned_join__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_partitioned_join__plan0_optimized.sql index ec2ef7f9fa..be2da473cc 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_partitioned_join__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_partitioned_join__plan0_optimized.sql @@ -4,7 +4,7 @@ -- Compute Metrics via Expressions SELECT users_ds_source_src_28000.home_state AS user__home_state - , SUM(subq_10.identity_verifications) AS identity_verifications + , SUM(subq_11.identity_verifications) AS identity_verifications FROM ( -- Read Elements From Semantic Model 'id_verifications' -- Metric Time Dimension 'ds' @@ -14,14 +14,14 @@ FROM ( , user_id AS user , 1 AS identity_verifications FROM ***************************.fct_id_verifications id_verifications_src_28000 -) subq_10 +) subq_11 LEFT OUTER JOIN ***************************.dim_users users_ds_source_src_28000 ON ( - subq_10.user = users_ds_source_src_28000.user_id + subq_11.user = users_ds_source_src_28000.user_id ) AND ( - subq_10.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_28000.ds_partitioned) + subq_11.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_28000.ds_partitioned) ) GROUP BY users_ds_source_src_28000.home_state diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_partitioned_join__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_partitioned_join__plan0.sql index 35eba9553f..d87df86a70 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_partitioned_join__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_partitioned_join__plan0.sql @@ -1,24 +1,24 @@ -- Compute Metrics via Expressions SELECT - subq_7.user__home_state - , subq_7.identity_verifications + subq_8.user__home_state + , subq_8.identity_verifications FROM ( -- Aggregate Measures SELECT - subq_6.user__home_state - , SUM(subq_6.identity_verifications) AS identity_verifications + subq_7.user__home_state + , SUM(subq_7.identity_verifications) AS identity_verifications FROM ( -- Pass Only Elements: ['identity_verifications', 'user__home_state'] SELECT - subq_5.user__home_state - , subq_5.identity_verifications + subq_6.user__home_state + , subq_6.identity_verifications FROM ( -- Join Standard Outputs SELECT subq_2.ds_partitioned__day AS ds_partitioned__day - , subq_4.ds_partitioned__day AS user__ds_partitioned__day + , subq_5.ds_partitioned__day AS user__ds_partitioned__day , subq_2.user AS user - , subq_4.home_state AS user__home_state + , subq_5.home_state AS user__home_state , subq_2.identity_verifications AS identity_verifications FROM ( -- Pass Only Elements: ['identity_verifications', 'ds_partitioned__day', 'user'] @@ -150,200 +150,394 @@ FROM ( LEFT OUTER JOIN ( -- Pass Only Elements: ['home_state', 'ds_partitioned__day', 'user'] SELECT - subq_3.ds_partitioned__day - , subq_3.user - , subq_3.home_state + subq_4.ds_partitioned__day + , subq_4.user + , subq_4.home_state FROM ( - -- Read Elements From Semantic Model 'users_ds_source' + -- Metric Time Dimension 'created_at' 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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_3 - ) subq_4 + subq_3.ds__day + , subq_3.ds__week + , subq_3.ds__month + , subq_3.ds__quarter + , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_day + , subq_3.ds__extract_dow + , subq_3.ds__extract_doy + , subq_3.created_at__day + , subq_3.created_at__week + , subq_3.created_at__month + , subq_3.created_at__quarter + , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy + , subq_3.ds_partitioned__day + , subq_3.ds_partitioned__week + , subq_3.ds_partitioned__month + , subq_3.ds_partitioned__quarter + , subq_3.ds_partitioned__year + , subq_3.ds_partitioned__extract_year + , subq_3.ds_partitioned__extract_quarter + , subq_3.ds_partitioned__extract_month + , subq_3.ds_partitioned__extract_day + , subq_3.ds_partitioned__extract_dow + , subq_3.ds_partitioned__extract_doy + , subq_3.last_profile_edit_ts__millisecond + , subq_3.last_profile_edit_ts__second + , subq_3.last_profile_edit_ts__minute + , subq_3.last_profile_edit_ts__hour + , subq_3.last_profile_edit_ts__day + , subq_3.last_profile_edit_ts__week + , subq_3.last_profile_edit_ts__month + , subq_3.last_profile_edit_ts__quarter + , subq_3.last_profile_edit_ts__year + , subq_3.last_profile_edit_ts__extract_year + , subq_3.last_profile_edit_ts__extract_quarter + , subq_3.last_profile_edit_ts__extract_month + , subq_3.last_profile_edit_ts__extract_day + , subq_3.last_profile_edit_ts__extract_dow + , subq_3.last_profile_edit_ts__extract_doy + , subq_3.bio_added_ts__second + , subq_3.bio_added_ts__minute + , subq_3.bio_added_ts__hour + , subq_3.bio_added_ts__day + , subq_3.bio_added_ts__week + , subq_3.bio_added_ts__month + , subq_3.bio_added_ts__quarter + , subq_3.bio_added_ts__year + , subq_3.bio_added_ts__extract_year + , subq_3.bio_added_ts__extract_quarter + , subq_3.bio_added_ts__extract_month + , subq_3.bio_added_ts__extract_day + , subq_3.bio_added_ts__extract_dow + , subq_3.bio_added_ts__extract_doy + , subq_3.last_login_ts__minute + , subq_3.last_login_ts__hour + , subq_3.last_login_ts__day + , subq_3.last_login_ts__week + , subq_3.last_login_ts__month + , subq_3.last_login_ts__quarter + , subq_3.last_login_ts__year + , subq_3.last_login_ts__extract_year + , subq_3.last_login_ts__extract_quarter + , subq_3.last_login_ts__extract_month + , subq_3.last_login_ts__extract_day + , subq_3.last_login_ts__extract_dow + , subq_3.last_login_ts__extract_doy + , subq_3.archived_at__hour + , subq_3.archived_at__day + , subq_3.archived_at__week + , subq_3.archived_at__month + , subq_3.archived_at__quarter + , subq_3.archived_at__year + , subq_3.archived_at__extract_year + , subq_3.archived_at__extract_quarter + , subq_3.archived_at__extract_month + , subq_3.archived_at__extract_day + , subq_3.archived_at__extract_dow + , subq_3.archived_at__extract_doy + , subq_3.user__ds__day + , subq_3.user__ds__week + , subq_3.user__ds__month + , subq_3.user__ds__quarter + , subq_3.user__ds__year + , subq_3.user__ds__extract_year + , subq_3.user__ds__extract_quarter + , subq_3.user__ds__extract_month + , subq_3.user__ds__extract_day + , subq_3.user__ds__extract_dow + , subq_3.user__ds__extract_doy + , subq_3.user__created_at__day + , subq_3.user__created_at__week + , subq_3.user__created_at__month + , subq_3.user__created_at__quarter + , subq_3.user__created_at__year + , subq_3.user__created_at__extract_year + , subq_3.user__created_at__extract_quarter + , subq_3.user__created_at__extract_month + , subq_3.user__created_at__extract_day + , subq_3.user__created_at__extract_dow + , subq_3.user__created_at__extract_doy + , subq_3.user__ds_partitioned__day + , subq_3.user__ds_partitioned__week + , subq_3.user__ds_partitioned__month + , subq_3.user__ds_partitioned__quarter + , subq_3.user__ds_partitioned__year + , subq_3.user__ds_partitioned__extract_year + , subq_3.user__ds_partitioned__extract_quarter + , subq_3.user__ds_partitioned__extract_month + , subq_3.user__ds_partitioned__extract_day + , subq_3.user__ds_partitioned__extract_dow + , subq_3.user__ds_partitioned__extract_doy + , subq_3.user__last_profile_edit_ts__millisecond + , subq_3.user__last_profile_edit_ts__second + , subq_3.user__last_profile_edit_ts__minute + , subq_3.user__last_profile_edit_ts__hour + , subq_3.user__last_profile_edit_ts__day + , subq_3.user__last_profile_edit_ts__week + , subq_3.user__last_profile_edit_ts__month + , subq_3.user__last_profile_edit_ts__quarter + , subq_3.user__last_profile_edit_ts__year + , subq_3.user__last_profile_edit_ts__extract_year + , subq_3.user__last_profile_edit_ts__extract_quarter + , subq_3.user__last_profile_edit_ts__extract_month + , subq_3.user__last_profile_edit_ts__extract_day + , subq_3.user__last_profile_edit_ts__extract_dow + , subq_3.user__last_profile_edit_ts__extract_doy + , subq_3.user__bio_added_ts__second + , subq_3.user__bio_added_ts__minute + , subq_3.user__bio_added_ts__hour + , subq_3.user__bio_added_ts__day + , subq_3.user__bio_added_ts__week + , subq_3.user__bio_added_ts__month + , subq_3.user__bio_added_ts__quarter + , subq_3.user__bio_added_ts__year + , subq_3.user__bio_added_ts__extract_year + , subq_3.user__bio_added_ts__extract_quarter + , subq_3.user__bio_added_ts__extract_month + , subq_3.user__bio_added_ts__extract_day + , subq_3.user__bio_added_ts__extract_dow + , subq_3.user__bio_added_ts__extract_doy + , subq_3.user__last_login_ts__minute + , subq_3.user__last_login_ts__hour + , subq_3.user__last_login_ts__day + , subq_3.user__last_login_ts__week + , subq_3.user__last_login_ts__month + , subq_3.user__last_login_ts__quarter + , subq_3.user__last_login_ts__year + , subq_3.user__last_login_ts__extract_year + , subq_3.user__last_login_ts__extract_quarter + , subq_3.user__last_login_ts__extract_month + , subq_3.user__last_login_ts__extract_day + , subq_3.user__last_login_ts__extract_dow + , subq_3.user__last_login_ts__extract_doy + , subq_3.user__archived_at__hour + , subq_3.user__archived_at__day + , subq_3.user__archived_at__week + , subq_3.user__archived_at__month + , subq_3.user__archived_at__quarter + , subq_3.user__archived_at__year + , subq_3.user__archived_at__extract_year + , subq_3.user__archived_at__extract_quarter + , subq_3.user__archived_at__extract_month + , subq_3.user__archived_at__extract_day + , subq_3.user__archived_at__extract_dow + , subq_3.user__archived_at__extract_doy + , subq_3.created_at__day AS metric_time__day + , subq_3.created_at__week AS metric_time__week + , subq_3.created_at__month AS metric_time__month + , subq_3.created_at__quarter AS metric_time__quarter + , subq_3.created_at__year AS metric_time__year + , subq_3.created_at__extract_year AS metric_time__extract_year + , subq_3.created_at__extract_quarter AS metric_time__extract_quarter + , subq_3.created_at__extract_month AS metric_time__extract_month + , subq_3.created_at__extract_day AS metric_time__extract_day + , subq_3.created_at__extract_dow AS metric_time__extract_dow + , subq_3.created_at__extract_doy AS metric_time__extract_doy + , subq_3.user + , subq_3.home_state + , subq_3.user__home_state + , subq_3.new_users + FROM ( + -- Read Elements From Semantic Model 'users_ds_source' + SELECT + 1 AS new_users + , 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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_3 + ) subq_4 + ) subq_5 ON ( - subq_2.user = subq_4.user + subq_2.user = subq_5.user ) AND ( - subq_2.ds_partitioned__day = subq_4.ds_partitioned__day + subq_2.ds_partitioned__day = subq_5.ds_partitioned__day ) - ) subq_5 - ) subq_6 + ) subq_6 + ) subq_7 GROUP BY - subq_6.user__home_state -) subq_7 + subq_7.user__home_state +) subq_8 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_partitioned_join__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_partitioned_join__plan0_optimized.sql index ec2ef7f9fa..be2da473cc 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_partitioned_join__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_partitioned_join__plan0_optimized.sql @@ -4,7 +4,7 @@ -- Compute Metrics via Expressions SELECT users_ds_source_src_28000.home_state AS user__home_state - , SUM(subq_10.identity_verifications) AS identity_verifications + , SUM(subq_11.identity_verifications) AS identity_verifications FROM ( -- Read Elements From Semantic Model 'id_verifications' -- Metric Time Dimension 'ds' @@ -14,14 +14,14 @@ FROM ( , user_id AS user , 1 AS identity_verifications FROM ***************************.fct_id_verifications id_verifications_src_28000 -) subq_10 +) subq_11 LEFT OUTER JOIN ***************************.dim_users users_ds_source_src_28000 ON ( - subq_10.user = users_ds_source_src_28000.user_id + subq_11.user = users_ds_source_src_28000.user_id ) AND ( - subq_10.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_28000.ds_partitioned) + subq_11.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_28000.ds_partitioned) ) GROUP BY users_ds_source_src_28000.home_state diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_partitioned_join__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_partitioned_join__plan0.sql index 72f660a182..be69bb3d8d 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_partitioned_join__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_partitioned_join__plan0.sql @@ -1,24 +1,24 @@ -- Compute Metrics via Expressions SELECT - subq_7.user__home_state - , subq_7.identity_verifications + subq_8.user__home_state + , subq_8.identity_verifications FROM ( -- Aggregate Measures SELECT - subq_6.user__home_state - , SUM(subq_6.identity_verifications) AS identity_verifications + subq_7.user__home_state + , SUM(subq_7.identity_verifications) AS identity_verifications FROM ( -- Pass Only Elements: ['identity_verifications', 'user__home_state'] SELECT - subq_5.user__home_state - , subq_5.identity_verifications + subq_6.user__home_state + , subq_6.identity_verifications FROM ( -- Join Standard Outputs SELECT subq_2.ds_partitioned__day AS ds_partitioned__day - , subq_4.ds_partitioned__day AS user__ds_partitioned__day + , subq_5.ds_partitioned__day AS user__ds_partitioned__day , subq_2.user AS user - , subq_4.home_state AS user__home_state + , subq_5.home_state AS user__home_state , subq_2.identity_verifications AS identity_verifications FROM ( -- Pass Only Elements: ['identity_verifications', 'ds_partitioned__day', 'user'] @@ -150,200 +150,394 @@ FROM ( LEFT OUTER JOIN ( -- Pass Only Elements: ['home_state', 'ds_partitioned__day', 'user'] SELECT - subq_3.ds_partitioned__day - , subq_3.user - , subq_3.home_state + subq_4.ds_partitioned__day + , subq_4.user + , subq_4.home_state FROM ( - -- Read Elements From Semantic Model 'users_ds_source' + -- Metric Time Dimension 'created_at' 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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_3 - ) subq_4 + subq_3.ds__day + , subq_3.ds__week + , subq_3.ds__month + , subq_3.ds__quarter + , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_day + , subq_3.ds__extract_dow + , subq_3.ds__extract_doy + , subq_3.created_at__day + , subq_3.created_at__week + , subq_3.created_at__month + , subq_3.created_at__quarter + , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy + , subq_3.ds_partitioned__day + , subq_3.ds_partitioned__week + , subq_3.ds_partitioned__month + , subq_3.ds_partitioned__quarter + , subq_3.ds_partitioned__year + , subq_3.ds_partitioned__extract_year + , subq_3.ds_partitioned__extract_quarter + , subq_3.ds_partitioned__extract_month + , subq_3.ds_partitioned__extract_day + , subq_3.ds_partitioned__extract_dow + , subq_3.ds_partitioned__extract_doy + , subq_3.last_profile_edit_ts__millisecond + , subq_3.last_profile_edit_ts__second + , subq_3.last_profile_edit_ts__minute + , subq_3.last_profile_edit_ts__hour + , subq_3.last_profile_edit_ts__day + , subq_3.last_profile_edit_ts__week + , subq_3.last_profile_edit_ts__month + , subq_3.last_profile_edit_ts__quarter + , subq_3.last_profile_edit_ts__year + , subq_3.last_profile_edit_ts__extract_year + , subq_3.last_profile_edit_ts__extract_quarter + , subq_3.last_profile_edit_ts__extract_month + , subq_3.last_profile_edit_ts__extract_day + , subq_3.last_profile_edit_ts__extract_dow + , subq_3.last_profile_edit_ts__extract_doy + , subq_3.bio_added_ts__second + , subq_3.bio_added_ts__minute + , subq_3.bio_added_ts__hour + , subq_3.bio_added_ts__day + , subq_3.bio_added_ts__week + , subq_3.bio_added_ts__month + , subq_3.bio_added_ts__quarter + , subq_3.bio_added_ts__year + , subq_3.bio_added_ts__extract_year + , subq_3.bio_added_ts__extract_quarter + , subq_3.bio_added_ts__extract_month + , subq_3.bio_added_ts__extract_day + , subq_3.bio_added_ts__extract_dow + , subq_3.bio_added_ts__extract_doy + , subq_3.last_login_ts__minute + , subq_3.last_login_ts__hour + , subq_3.last_login_ts__day + , subq_3.last_login_ts__week + , subq_3.last_login_ts__month + , subq_3.last_login_ts__quarter + , subq_3.last_login_ts__year + , subq_3.last_login_ts__extract_year + , subq_3.last_login_ts__extract_quarter + , subq_3.last_login_ts__extract_month + , subq_3.last_login_ts__extract_day + , subq_3.last_login_ts__extract_dow + , subq_3.last_login_ts__extract_doy + , subq_3.archived_at__hour + , subq_3.archived_at__day + , subq_3.archived_at__week + , subq_3.archived_at__month + , subq_3.archived_at__quarter + , subq_3.archived_at__year + , subq_3.archived_at__extract_year + , subq_3.archived_at__extract_quarter + , subq_3.archived_at__extract_month + , subq_3.archived_at__extract_day + , subq_3.archived_at__extract_dow + , subq_3.archived_at__extract_doy + , subq_3.user__ds__day + , subq_3.user__ds__week + , subq_3.user__ds__month + , subq_3.user__ds__quarter + , subq_3.user__ds__year + , subq_3.user__ds__extract_year + , subq_3.user__ds__extract_quarter + , subq_3.user__ds__extract_month + , subq_3.user__ds__extract_day + , subq_3.user__ds__extract_dow + , subq_3.user__ds__extract_doy + , subq_3.user__created_at__day + , subq_3.user__created_at__week + , subq_3.user__created_at__month + , subq_3.user__created_at__quarter + , subq_3.user__created_at__year + , subq_3.user__created_at__extract_year + , subq_3.user__created_at__extract_quarter + , subq_3.user__created_at__extract_month + , subq_3.user__created_at__extract_day + , subq_3.user__created_at__extract_dow + , subq_3.user__created_at__extract_doy + , subq_3.user__ds_partitioned__day + , subq_3.user__ds_partitioned__week + , subq_3.user__ds_partitioned__month + , subq_3.user__ds_partitioned__quarter + , subq_3.user__ds_partitioned__year + , subq_3.user__ds_partitioned__extract_year + , subq_3.user__ds_partitioned__extract_quarter + , subq_3.user__ds_partitioned__extract_month + , subq_3.user__ds_partitioned__extract_day + , subq_3.user__ds_partitioned__extract_dow + , subq_3.user__ds_partitioned__extract_doy + , subq_3.user__last_profile_edit_ts__millisecond + , subq_3.user__last_profile_edit_ts__second + , subq_3.user__last_profile_edit_ts__minute + , subq_3.user__last_profile_edit_ts__hour + , subq_3.user__last_profile_edit_ts__day + , subq_3.user__last_profile_edit_ts__week + , subq_3.user__last_profile_edit_ts__month + , subq_3.user__last_profile_edit_ts__quarter + , subq_3.user__last_profile_edit_ts__year + , subq_3.user__last_profile_edit_ts__extract_year + , subq_3.user__last_profile_edit_ts__extract_quarter + , subq_3.user__last_profile_edit_ts__extract_month + , subq_3.user__last_profile_edit_ts__extract_day + , subq_3.user__last_profile_edit_ts__extract_dow + , subq_3.user__last_profile_edit_ts__extract_doy + , subq_3.user__bio_added_ts__second + , subq_3.user__bio_added_ts__minute + , subq_3.user__bio_added_ts__hour + , subq_3.user__bio_added_ts__day + , subq_3.user__bio_added_ts__week + , subq_3.user__bio_added_ts__month + , subq_3.user__bio_added_ts__quarter + , subq_3.user__bio_added_ts__year + , subq_3.user__bio_added_ts__extract_year + , subq_3.user__bio_added_ts__extract_quarter + , subq_3.user__bio_added_ts__extract_month + , subq_3.user__bio_added_ts__extract_day + , subq_3.user__bio_added_ts__extract_dow + , subq_3.user__bio_added_ts__extract_doy + , subq_3.user__last_login_ts__minute + , subq_3.user__last_login_ts__hour + , subq_3.user__last_login_ts__day + , subq_3.user__last_login_ts__week + , subq_3.user__last_login_ts__month + , subq_3.user__last_login_ts__quarter + , subq_3.user__last_login_ts__year + , subq_3.user__last_login_ts__extract_year + , subq_3.user__last_login_ts__extract_quarter + , subq_3.user__last_login_ts__extract_month + , subq_3.user__last_login_ts__extract_day + , subq_3.user__last_login_ts__extract_dow + , subq_3.user__last_login_ts__extract_doy + , subq_3.user__archived_at__hour + , subq_3.user__archived_at__day + , subq_3.user__archived_at__week + , subq_3.user__archived_at__month + , subq_3.user__archived_at__quarter + , subq_3.user__archived_at__year + , subq_3.user__archived_at__extract_year + , subq_3.user__archived_at__extract_quarter + , subq_3.user__archived_at__extract_month + , subq_3.user__archived_at__extract_day + , subq_3.user__archived_at__extract_dow + , subq_3.user__archived_at__extract_doy + , subq_3.created_at__day AS metric_time__day + , subq_3.created_at__week AS metric_time__week + , subq_3.created_at__month AS metric_time__month + , subq_3.created_at__quarter AS metric_time__quarter + , subq_3.created_at__year AS metric_time__year + , subq_3.created_at__extract_year AS metric_time__extract_year + , subq_3.created_at__extract_quarter AS metric_time__extract_quarter + , subq_3.created_at__extract_month AS metric_time__extract_month + , subq_3.created_at__extract_day AS metric_time__extract_day + , subq_3.created_at__extract_dow AS metric_time__extract_dow + , subq_3.created_at__extract_doy AS metric_time__extract_doy + , subq_3.user + , subq_3.home_state + , subq_3.user__home_state + , subq_3.new_users + FROM ( + -- Read Elements From Semantic Model 'users_ds_source' + SELECT + 1 AS new_users + , 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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_3 + ) subq_4 + ) subq_5 ON ( - subq_2.user = subq_4.user + subq_2.user = subq_5.user ) AND ( - subq_2.ds_partitioned__day = subq_4.ds_partitioned__day + subq_2.ds_partitioned__day = subq_5.ds_partitioned__day ) - ) subq_5 - ) subq_6 + ) subq_6 + ) subq_7 GROUP BY - subq_6.user__home_state -) subq_7 + subq_7.user__home_state +) subq_8 diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_partitioned_join__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_partitioned_join__plan0_optimized.sql index ec2ef7f9fa..be2da473cc 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_partitioned_join__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_partitioned_join__plan0_optimized.sql @@ -4,7 +4,7 @@ -- Compute Metrics via Expressions SELECT users_ds_source_src_28000.home_state AS user__home_state - , SUM(subq_10.identity_verifications) AS identity_verifications + , SUM(subq_11.identity_verifications) AS identity_verifications FROM ( -- Read Elements From Semantic Model 'id_verifications' -- Metric Time Dimension 'ds' @@ -14,14 +14,14 @@ FROM ( , user_id AS user , 1 AS identity_verifications FROM ***************************.fct_id_verifications id_verifications_src_28000 -) subq_10 +) subq_11 LEFT OUTER JOIN ***************************.dim_users users_ds_source_src_28000 ON ( - subq_10.user = users_ds_source_src_28000.user_id + subq_11.user = users_ds_source_src_28000.user_id ) AND ( - subq_10.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_28000.ds_partitioned) + subq_11.ds_partitioned__day = DATE_TRUNC('day', users_ds_source_src_28000.ds_partitioned) ) GROUP BY users_ds_source_src_28000.home_state From 044c89838434bfbf5ea81af590497054d22c8a42 Mon Sep 17 00:00:00 2001 From: Courtney Holcomb Date: Mon, 29 Jul 2024 17:13:40 -0700 Subject: [PATCH 3/3] Add SQL tests for simple metrics with sub-daily dimensions --- .../test_granularity_date_part_rendering.py | 61 + ...with_joined_sub_daily_dimension__plan0.sql | 1303 +++++++++++++++++ ...d_sub_daily_dimension__plan0_optimized.sql | 38 + ...metric_with_sub_daily_dimension__plan0.sql | 394 +++++ ...h_sub_daily_dimension__plan0_optimized.sql | 16 + ...with_joined_sub_daily_dimension__plan0.sql | 1303 +++++++++++++++++ ...d_sub_daily_dimension__plan0_optimized.sql | 38 + ...metric_with_sub_daily_dimension__plan0.sql | 394 +++++ ...h_sub_daily_dimension__plan0_optimized.sql | 16 + ...with_joined_sub_daily_dimension__plan0.sql | 1303 +++++++++++++++++ ...d_sub_daily_dimension__plan0_optimized.sql | 38 + ...metric_with_sub_daily_dimension__plan0.sql | 394 +++++ ...h_sub_daily_dimension__plan0_optimized.sql | 16 + ...with_joined_sub_daily_dimension__plan0.sql | 1303 +++++++++++++++++ ...d_sub_daily_dimension__plan0_optimized.sql | 38 + ...metric_with_sub_daily_dimension__plan0.sql | 394 +++++ ...h_sub_daily_dimension__plan0_optimized.sql | 16 + ...with_joined_sub_daily_dimension__plan0.sql | 1303 +++++++++++++++++ ...d_sub_daily_dimension__plan0_optimized.sql | 38 + ...metric_with_sub_daily_dimension__plan0.sql | 394 +++++ ...h_sub_daily_dimension__plan0_optimized.sql | 16 + ...with_joined_sub_daily_dimension__plan0.sql | 1303 +++++++++++++++++ ...d_sub_daily_dimension__plan0_optimized.sql | 38 + ...metric_with_sub_daily_dimension__plan0.sql | 394 +++++ ...h_sub_daily_dimension__plan0_optimized.sql | 16 + ...with_joined_sub_daily_dimension__plan0.sql | 1303 +++++++++++++++++ ...d_sub_daily_dimension__plan0_optimized.sql | 38 + ...metric_with_sub_daily_dimension__plan0.sql | 394 +++++ ...h_sub_daily_dimension__plan0_optimized.sql | 16 + 29 files changed, 12318 insertions(+) create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_metric_with_sub_daily_dimension__plan0.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_metric_with_sub_daily_dimension__plan0.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_metric_with_sub_daily_dimension__plan0.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_metric_with_sub_daily_dimension__plan0.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_metric_with_sub_daily_dimension__plan0.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_metric_with_sub_daily_dimension__plan0.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_metric_with_sub_daily_dimension__plan0.sql create mode 100644 tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql diff --git a/tests_metricflow/query_rendering/test_granularity_date_part_rendering.py b/tests_metricflow/query_rendering/test_granularity_date_part_rendering.py index d675db12b1..164815fd64 100644 --- a/tests_metricflow/query_rendering/test_granularity_date_part_rendering.py +++ b/tests_metricflow/query_rendering/test_granularity_date_part_rendering.py @@ -151,3 +151,64 @@ def test_sub_daily_dimension( # noqa: D103 dataflow_plan_builder=dataflow_plan_builder, query_spec=query_spec, ) + + +@pytest.mark.sql_engine_snapshot +def test_simple_metric_with_sub_daily_dimension( # noqa: D103 + request: FixtureRequest, + mf_test_configuration: MetricFlowTestConfiguration, + dataflow_plan_builder: DataflowPlanBuilder, + dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, + sql_client: SqlClient, +) -> None: + query_spec = MetricFlowQuerySpec( + metric_specs=(MetricSpec("new_users"),), + time_dimension_specs=( + TimeDimensionSpec( + element_name="archived_at", + time_granularity=TimeGranularity.HOUR, + entity_links=(EntityReference("user"),), + ), + ), + ) + + render_and_check( + request=request, + mf_test_configuration=mf_test_configuration, + dataflow_to_sql_converter=dataflow_to_sql_converter, + sql_client=sql_client, + dataflow_plan_builder=dataflow_plan_builder, + query_spec=query_spec, + ) + + +@pytest.mark.sql_engine_snapshot +def test_simple_metric_with_joined_sub_daily_dimension( # noqa: D103 + request: FixtureRequest, + mf_test_configuration: MetricFlowTestConfiguration, + dataflow_plan_builder: DataflowPlanBuilder, + dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter, + sql_client: SqlClient, +) -> None: + query_spec = MetricFlowQuerySpec( + metric_specs=(MetricSpec("bookings"),), + time_dimension_specs=( + TimeDimensionSpec( + element_name="bio_added_ts", + time_granularity=TimeGranularity.MINUTE, + entity_links=( + EntityReference("listing"), + EntityReference("user"), + ), + ), + ), + ) + + render_and_check( + request=request, + mf_test_configuration=mf_test_configuration, + dataflow_to_sql_converter=dataflow_to_sql_converter, + sql_client=sql_client, + dataflow_plan_builder=dataflow_plan_builder, + query_spec=query_spec, + ) diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql new file mode 100644 index 0000000000..e698e92cef --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql @@ -0,0 +1,1303 @@ +-- Compute Metrics via Expressions +SELECT + subq_12.listing__user__bio_added_ts__minute + , subq_12.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_11.listing__user__bio_added_ts__minute + , SUM(subq_11.bookings) AS bookings + FROM ( + -- Pass Only Elements: ['bookings', 'listing__user__bio_added_ts__minute'] + SELECT + subq_10.listing__user__bio_added_ts__minute + , subq_10.bookings + FROM ( + -- Join Standard Outputs + SELECT + subq_2.ds_partitioned__day AS ds_partitioned__day + , subq_9.user__ds_partitioned__day AS listing__user__ds_partitioned__day + , subq_9.user__bio_added_ts__minute AS listing__user__bio_added_ts__minute + , subq_2.listing AS listing + , subq_2.bookings AS bookings + FROM ( + -- Pass Only Elements: ['bookings', 'ds_partitioned__day', 'listing'] + SELECT + subq_1.ds_partitioned__day + , subq_1.listing + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_28000.booking_value + , bookings_source_src_28000.booking_value AS max_booking_value + , bookings_source_src_28000.booking_value AS min_booking_value + , bookings_source_src_28000.guest_id AS bookers + , bookings_source_src_28000.booking_value AS average_booking_value + , bookings_source_src_28000.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_28000.booking_value AS median_booking_value + , bookings_source_src_28000.booking_value AS booking_value_p99 + , bookings_source_src_28000.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28000.is_instant + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS ds__year + , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS ds__extract_doy + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy + , bookings_source_src_28000.is_instant AS booking__is_instant + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS booking__ds__day + , DATETIME_TRUNC(bookings_source_src_28000.ds, isoweek) AS booking__ds__week + , DATETIME_TRUNC(bookings_source_src_28000.ds, month) AS booking__ds__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, quarter) AS booking__ds__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds, year) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds) - 1) AS booking__ds__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, day) AS booking__ds_partitioned__day + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, isoweek) AS booking__ds_partitioned__week + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, month) AS booking__ds_partitioned__month + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, quarter) AS booking__ds_partitioned__quarter + , DATETIME_TRUNC(bookings_source_src_28000.ds_partitioned, year) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, day) AS booking__paid_at__day + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, isoweek) AS booking__paid_at__week + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, month) AS booking__paid_at__month + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, quarter) AS booking__paid_at__quarter + , DATETIME_TRUNC(bookings_source_src_28000.paid_at, year) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day + , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow + , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28000.listing_id AS listing + , bookings_source_src_28000.guest_id AS guest + , bookings_source_src_28000.host_id AS host + , bookings_source_src_28000.listing_id AS booking__listing + , bookings_source_src_28000.guest_id AS booking__guest + , bookings_source_src_28000.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28000 + ) subq_0 + ) subq_1 + ) subq_2 + LEFT OUTER JOIN ( + -- Pass Only Elements: ['user__ds_partitioned__day', 'user__bio_added_ts__minute', 'listing'] + SELECT + subq_8.user__ds_partitioned__day + , subq_8.user__bio_added_ts__minute + , subq_8.listing + FROM ( + -- Join Standard Outputs + SELECT + subq_4.ds__day AS ds__day + , subq_4.ds__week AS ds__week + , subq_4.ds__month AS ds__month + , subq_4.ds__quarter AS ds__quarter + , subq_4.ds__year AS ds__year + , subq_4.ds__extract_year AS ds__extract_year + , subq_4.ds__extract_quarter AS ds__extract_quarter + , subq_4.ds__extract_month AS ds__extract_month + , subq_4.ds__extract_day AS ds__extract_day + , subq_4.ds__extract_dow AS ds__extract_dow + , subq_4.ds__extract_doy AS ds__extract_doy + , subq_4.created_at__day AS created_at__day + , subq_4.created_at__week AS created_at__week + , subq_4.created_at__month AS created_at__month + , subq_4.created_at__quarter AS created_at__quarter + , subq_4.created_at__year AS created_at__year + , subq_4.created_at__extract_year AS created_at__extract_year + , subq_4.created_at__extract_quarter AS created_at__extract_quarter + , subq_4.created_at__extract_month AS created_at__extract_month + , subq_4.created_at__extract_day AS created_at__extract_day + , subq_4.created_at__extract_dow AS created_at__extract_dow + , subq_4.created_at__extract_doy AS created_at__extract_doy + , subq_4.listing__ds__day AS listing__ds__day + , subq_4.listing__ds__week AS listing__ds__week + , subq_4.listing__ds__month AS listing__ds__month + , subq_4.listing__ds__quarter AS listing__ds__quarter + , subq_4.listing__ds__year AS listing__ds__year + , subq_4.listing__ds__extract_year AS listing__ds__extract_year + , subq_4.listing__ds__extract_quarter AS listing__ds__extract_quarter + , subq_4.listing__ds__extract_month AS listing__ds__extract_month + , subq_4.listing__ds__extract_day AS listing__ds__extract_day + , subq_4.listing__ds__extract_dow AS listing__ds__extract_dow + , subq_4.listing__ds__extract_doy AS listing__ds__extract_doy + , subq_4.listing__created_at__day AS listing__created_at__day + , subq_4.listing__created_at__week AS listing__created_at__week + , subq_4.listing__created_at__month AS listing__created_at__month + , subq_4.listing__created_at__quarter AS listing__created_at__quarter + , subq_4.listing__created_at__year AS listing__created_at__year + , subq_4.listing__created_at__extract_year AS listing__created_at__extract_year + , subq_4.listing__created_at__extract_quarter AS listing__created_at__extract_quarter + , subq_4.listing__created_at__extract_month AS listing__created_at__extract_month + , subq_4.listing__created_at__extract_day AS listing__created_at__extract_day + , subq_4.listing__created_at__extract_dow AS listing__created_at__extract_dow + , subq_4.listing__created_at__extract_doy AS listing__created_at__extract_doy + , subq_4.metric_time__day AS metric_time__day + , 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_7.ds__day AS user__ds__day + , subq_7.ds__week AS user__ds__week + , subq_7.ds__month AS user__ds__month + , subq_7.ds__quarter AS user__ds__quarter + , subq_7.ds__year AS user__ds__year + , subq_7.ds__extract_year AS user__ds__extract_year + , subq_7.ds__extract_quarter AS user__ds__extract_quarter + , subq_7.ds__extract_month AS user__ds__extract_month + , subq_7.ds__extract_day AS user__ds__extract_day + , subq_7.ds__extract_dow AS user__ds__extract_dow + , subq_7.ds__extract_doy AS user__ds__extract_doy + , subq_7.created_at__day AS user__created_at__day + , subq_7.created_at__week AS user__created_at__week + , subq_7.created_at__month AS user__created_at__month + , subq_7.created_at__quarter AS user__created_at__quarter + , subq_7.created_at__year AS user__created_at__year + , subq_7.created_at__extract_year AS user__created_at__extract_year + , subq_7.created_at__extract_quarter AS user__created_at__extract_quarter + , subq_7.created_at__extract_month AS user__created_at__extract_month + , subq_7.created_at__extract_day AS user__created_at__extract_day + , subq_7.created_at__extract_dow AS user__created_at__extract_dow + , subq_7.created_at__extract_doy AS user__created_at__extract_doy + , subq_7.ds_partitioned__day AS user__ds_partitioned__day + , subq_7.ds_partitioned__week AS user__ds_partitioned__week + , subq_7.ds_partitioned__month AS user__ds_partitioned__month + , subq_7.ds_partitioned__quarter AS user__ds_partitioned__quarter + , subq_7.ds_partitioned__year AS user__ds_partitioned__year + , subq_7.ds_partitioned__extract_year AS user__ds_partitioned__extract_year + , subq_7.ds_partitioned__extract_quarter AS user__ds_partitioned__extract_quarter + , subq_7.ds_partitioned__extract_month AS user__ds_partitioned__extract_month + , subq_7.ds_partitioned__extract_day AS user__ds_partitioned__extract_day + , subq_7.ds_partitioned__extract_dow AS user__ds_partitioned__extract_dow + , subq_7.ds_partitioned__extract_doy AS user__ds_partitioned__extract_doy + , subq_7.last_profile_edit_ts__millisecond AS user__last_profile_edit_ts__millisecond + , subq_7.last_profile_edit_ts__second AS user__last_profile_edit_ts__second + , subq_7.last_profile_edit_ts__minute AS user__last_profile_edit_ts__minute + , subq_7.last_profile_edit_ts__hour AS user__last_profile_edit_ts__hour + , subq_7.last_profile_edit_ts__day AS user__last_profile_edit_ts__day + , subq_7.last_profile_edit_ts__week AS user__last_profile_edit_ts__week + , subq_7.last_profile_edit_ts__month AS user__last_profile_edit_ts__month + , subq_7.last_profile_edit_ts__quarter AS user__last_profile_edit_ts__quarter + , subq_7.last_profile_edit_ts__year AS user__last_profile_edit_ts__year + , subq_7.last_profile_edit_ts__extract_year AS user__last_profile_edit_ts__extract_year + , subq_7.last_profile_edit_ts__extract_quarter AS user__last_profile_edit_ts__extract_quarter + , subq_7.last_profile_edit_ts__extract_month AS user__last_profile_edit_ts__extract_month + , subq_7.last_profile_edit_ts__extract_day AS user__last_profile_edit_ts__extract_day + , subq_7.last_profile_edit_ts__extract_dow AS user__last_profile_edit_ts__extract_dow + , subq_7.last_profile_edit_ts__extract_doy AS user__last_profile_edit_ts__extract_doy + , subq_7.bio_added_ts__second AS user__bio_added_ts__second + , subq_7.bio_added_ts__minute AS user__bio_added_ts__minute + , subq_7.bio_added_ts__hour AS user__bio_added_ts__hour + , subq_7.bio_added_ts__day AS user__bio_added_ts__day + , subq_7.bio_added_ts__week AS user__bio_added_ts__week + , subq_7.bio_added_ts__month AS user__bio_added_ts__month + , subq_7.bio_added_ts__quarter AS user__bio_added_ts__quarter + , subq_7.bio_added_ts__year AS user__bio_added_ts__year + , subq_7.bio_added_ts__extract_year AS user__bio_added_ts__extract_year + , subq_7.bio_added_ts__extract_quarter AS user__bio_added_ts__extract_quarter + , subq_7.bio_added_ts__extract_month AS user__bio_added_ts__extract_month + , subq_7.bio_added_ts__extract_day AS user__bio_added_ts__extract_day + , subq_7.bio_added_ts__extract_dow AS user__bio_added_ts__extract_dow + , subq_7.bio_added_ts__extract_doy AS user__bio_added_ts__extract_doy + , subq_7.last_login_ts__minute AS user__last_login_ts__minute + , subq_7.last_login_ts__hour AS user__last_login_ts__hour + , subq_7.last_login_ts__day AS user__last_login_ts__day + , subq_7.last_login_ts__week AS user__last_login_ts__week + , subq_7.last_login_ts__month AS user__last_login_ts__month + , subq_7.last_login_ts__quarter AS user__last_login_ts__quarter + , subq_7.last_login_ts__year AS user__last_login_ts__year + , subq_7.last_login_ts__extract_year AS user__last_login_ts__extract_year + , subq_7.last_login_ts__extract_quarter AS user__last_login_ts__extract_quarter + , subq_7.last_login_ts__extract_month AS user__last_login_ts__extract_month + , subq_7.last_login_ts__extract_day AS user__last_login_ts__extract_day + , subq_7.last_login_ts__extract_dow AS user__last_login_ts__extract_dow + , subq_7.last_login_ts__extract_doy AS user__last_login_ts__extract_doy + , subq_7.archived_at__hour AS user__archived_at__hour + , subq_7.archived_at__day AS user__archived_at__day + , subq_7.archived_at__week AS user__archived_at__week + , subq_7.archived_at__month AS user__archived_at__month + , subq_7.archived_at__quarter AS user__archived_at__quarter + , subq_7.archived_at__year AS user__archived_at__year + , subq_7.archived_at__extract_year AS user__archived_at__extract_year + , subq_7.archived_at__extract_quarter AS user__archived_at__extract_quarter + , subq_7.archived_at__extract_month AS user__archived_at__extract_month + , subq_7.archived_at__extract_day AS user__archived_at__extract_day + , subq_7.archived_at__extract_dow AS user__archived_at__extract_dow + , subq_7.archived_at__extract_doy AS user__archived_at__extract_doy + , subq_7.metric_time__day AS user__metric_time__day + , subq_7.metric_time__week AS user__metric_time__week + , subq_7.metric_time__month AS user__metric_time__month + , subq_7.metric_time__quarter AS user__metric_time__quarter + , subq_7.metric_time__year AS user__metric_time__year + , subq_7.metric_time__extract_year AS user__metric_time__extract_year + , subq_7.metric_time__extract_quarter AS user__metric_time__extract_quarter + , subq_7.metric_time__extract_month AS user__metric_time__extract_month + , subq_7.metric_time__extract_day AS user__metric_time__extract_day + , subq_7.metric_time__extract_dow AS user__metric_time__extract_dow + , subq_7.metric_time__extract_doy AS user__metric_time__extract_doy + , subq_4.listing AS listing + , subq_4.user AS user + , subq_4.listing__user AS listing__user + , subq_4.country_latest AS country_latest + , subq_4.is_lux_latest AS is_lux_latest + , subq_4.capacity_latest AS capacity_latest + , subq_4.listing__country_latest AS listing__country_latest + , subq_4.listing__is_lux_latest AS listing__is_lux_latest + , subq_4.listing__capacity_latest AS listing__capacity_latest + , subq_7.home_state AS user__home_state + , subq_4.listings AS listings + , subq_4.largest_listing AS largest_listing + , subq_4.smallest_listing AS smallest_listing + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_3.ds__day + , subq_3.ds__week + , subq_3.ds__month + , subq_3.ds__quarter + , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_day + , subq_3.ds__extract_dow + , subq_3.ds__extract_doy + , subq_3.created_at__day + , subq_3.created_at__week + , subq_3.created_at__month + , subq_3.created_at__quarter + , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy + , subq_3.listing__ds__day + , subq_3.listing__ds__week + , subq_3.listing__ds__month + , subq_3.listing__ds__quarter + , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dow + , subq_3.listing__ds__extract_doy + , subq_3.listing__created_at__day + , subq_3.listing__created_at__week + , subq_3.listing__created_at__month + , subq_3.listing__created_at__quarter + , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dow + , subq_3.listing__created_at__extract_doy + , subq_3.ds__day AS metric_time__day + , subq_3.ds__week AS metric_time__week + , subq_3.ds__month AS metric_time__month + , subq_3.ds__quarter AS metric_time__quarter + , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy + , subq_3.listing + , subq_3.user + , subq_3.listing__user + , subq_3.country_latest + , subq_3.is_lux_latest + , subq_3.capacity_latest + , subq_3.listing__country_latest + , subq_3.listing__is_lux_latest + , subq_3.listing__capacity_latest + , subq_3.listings + , subq_3.largest_listing + , subq_3.smallest_listing + FROM ( + -- Read Elements From Semantic Model 'listings_latest' + 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 + FROM ***************************.dim_listings_latest listings_latest_src_28000 + ) subq_3 + ) subq_4 + LEFT OUTER JOIN ( + -- Pass Only Elements: [ + -- 'home_state', + -- 'user__home_state', + -- 'ds__day', + -- 'ds__week', + -- 'ds__month', + -- 'ds__quarter', + -- 'ds__year', + -- 'ds__extract_year', + -- 'ds__extract_quarter', + -- 'ds__extract_month', + -- 'ds__extract_day', + -- 'ds__extract_dow', + -- 'ds__extract_doy', + -- 'created_at__day', + -- 'created_at__week', + -- 'created_at__month', + -- 'created_at__quarter', + -- 'created_at__year', + -- 'created_at__extract_year', + -- 'created_at__extract_quarter', + -- 'created_at__extract_month', + -- 'created_at__extract_day', + -- 'created_at__extract_dow', + -- 'created_at__extract_doy', + -- 'ds_partitioned__day', + -- 'ds_partitioned__week', + -- 'ds_partitioned__month', + -- 'ds_partitioned__quarter', + -- 'ds_partitioned__year', + -- 'ds_partitioned__extract_year', + -- 'ds_partitioned__extract_quarter', + -- 'ds_partitioned__extract_month', + -- 'ds_partitioned__extract_day', + -- 'ds_partitioned__extract_dow', + -- 'ds_partitioned__extract_doy', + -- 'last_profile_edit_ts__millisecond', + -- 'last_profile_edit_ts__second', + -- 'last_profile_edit_ts__minute', + -- 'last_profile_edit_ts__hour', + -- 'last_profile_edit_ts__day', + -- 'last_profile_edit_ts__week', + -- 'last_profile_edit_ts__month', + -- 'last_profile_edit_ts__quarter', + -- 'last_profile_edit_ts__year', + -- 'last_profile_edit_ts__extract_year', + -- 'last_profile_edit_ts__extract_quarter', + -- 'last_profile_edit_ts__extract_month', + -- 'last_profile_edit_ts__extract_day', + -- 'last_profile_edit_ts__extract_dow', + -- 'last_profile_edit_ts__extract_doy', + -- 'bio_added_ts__second', + -- 'bio_added_ts__minute', + -- 'bio_added_ts__hour', + -- 'bio_added_ts__day', + -- 'bio_added_ts__week', + -- 'bio_added_ts__month', + -- 'bio_added_ts__quarter', + -- 'bio_added_ts__year', + -- 'bio_added_ts__extract_year', + -- 'bio_added_ts__extract_quarter', + -- 'bio_added_ts__extract_month', + -- 'bio_added_ts__extract_day', + -- 'bio_added_ts__extract_dow', + -- 'bio_added_ts__extract_doy', + -- 'last_login_ts__minute', + -- 'last_login_ts__hour', + -- 'last_login_ts__day', + -- 'last_login_ts__week', + -- 'last_login_ts__month', + -- 'last_login_ts__quarter', + -- 'last_login_ts__year', + -- 'last_login_ts__extract_year', + -- 'last_login_ts__extract_quarter', + -- 'last_login_ts__extract_month', + -- 'last_login_ts__extract_day', + -- 'last_login_ts__extract_dow', + -- 'last_login_ts__extract_doy', + -- 'archived_at__hour', + -- 'archived_at__day', + -- 'archived_at__week', + -- 'archived_at__month', + -- 'archived_at__quarter', + -- 'archived_at__year', + -- 'archived_at__extract_year', + -- 'archived_at__extract_quarter', + -- 'archived_at__extract_month', + -- 'archived_at__extract_day', + -- 'archived_at__extract_dow', + -- 'archived_at__extract_doy', + -- 'user__ds__day', + -- 'user__ds__week', + -- 'user__ds__month', + -- 'user__ds__quarter', + -- 'user__ds__year', + -- 'user__ds__extract_year', + -- 'user__ds__extract_quarter', + -- 'user__ds__extract_month', + -- 'user__ds__extract_day', + -- 'user__ds__extract_dow', + -- 'user__ds__extract_doy', + -- 'user__created_at__day', + -- 'user__created_at__week', + -- 'user__created_at__month', + -- 'user__created_at__quarter', + -- 'user__created_at__year', + -- 'user__created_at__extract_year', + -- 'user__created_at__extract_quarter', + -- 'user__created_at__extract_month', + -- 'user__created_at__extract_day', + -- 'user__created_at__extract_dow', + -- 'user__created_at__extract_doy', + -- 'user__ds_partitioned__day', + -- 'user__ds_partitioned__week', + -- 'user__ds_partitioned__month', + -- 'user__ds_partitioned__quarter', + -- 'user__ds_partitioned__year', + -- 'user__ds_partitioned__extract_year', + -- 'user__ds_partitioned__extract_quarter', + -- 'user__ds_partitioned__extract_month', + -- 'user__ds_partitioned__extract_day', + -- 'user__ds_partitioned__extract_dow', + -- 'user__ds_partitioned__extract_doy', + -- 'user__last_profile_edit_ts__millisecond', + -- 'user__last_profile_edit_ts__second', + -- 'user__last_profile_edit_ts__minute', + -- 'user__last_profile_edit_ts__hour', + -- 'user__last_profile_edit_ts__day', + -- 'user__last_profile_edit_ts__week', + -- 'user__last_profile_edit_ts__month', + -- 'user__last_profile_edit_ts__quarter', + -- 'user__last_profile_edit_ts__year', + -- 'user__last_profile_edit_ts__extract_year', + -- 'user__last_profile_edit_ts__extract_quarter', + -- 'user__last_profile_edit_ts__extract_month', + -- 'user__last_profile_edit_ts__extract_day', + -- 'user__last_profile_edit_ts__extract_dow', + -- 'user__last_profile_edit_ts__extract_doy', + -- 'user__bio_added_ts__second', + -- 'user__bio_added_ts__minute', + -- 'user__bio_added_ts__hour', + -- 'user__bio_added_ts__day', + -- 'user__bio_added_ts__week', + -- 'user__bio_added_ts__month', + -- 'user__bio_added_ts__quarter', + -- 'user__bio_added_ts__year', + -- 'user__bio_added_ts__extract_year', + -- 'user__bio_added_ts__extract_quarter', + -- 'user__bio_added_ts__extract_month', + -- 'user__bio_added_ts__extract_day', + -- 'user__bio_added_ts__extract_dow', + -- 'user__bio_added_ts__extract_doy', + -- 'user__last_login_ts__minute', + -- 'user__last_login_ts__hour', + -- 'user__last_login_ts__day', + -- 'user__last_login_ts__week', + -- 'user__last_login_ts__month', + -- 'user__last_login_ts__quarter', + -- 'user__last_login_ts__year', + -- 'user__last_login_ts__extract_year', + -- 'user__last_login_ts__extract_quarter', + -- 'user__last_login_ts__extract_month', + -- 'user__last_login_ts__extract_day', + -- 'user__last_login_ts__extract_dow', + -- 'user__last_login_ts__extract_doy', + -- 'user__archived_at__hour', + -- 'user__archived_at__day', + -- 'user__archived_at__week', + -- 'user__archived_at__month', + -- 'user__archived_at__quarter', + -- 'user__archived_at__year', + -- 'user__archived_at__extract_year', + -- 'user__archived_at__extract_quarter', + -- 'user__archived_at__extract_month', + -- 'user__archived_at__extract_day', + -- 'user__archived_at__extract_dow', + -- 'user__archived_at__extract_doy', + -- 'metric_time__day', + -- 'metric_time__week', + -- 'metric_time__month', + -- 'metric_time__quarter', + -- 'metric_time__year', + -- 'metric_time__extract_year', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_month', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'user', + -- ] + SELECT + subq_6.ds__day + , subq_6.ds__week + , subq_6.ds__month + , subq_6.ds__quarter + , subq_6.ds__year + , subq_6.ds__extract_year + , subq_6.ds__extract_quarter + , subq_6.ds__extract_month + , subq_6.ds__extract_day + , subq_6.ds__extract_dow + , subq_6.ds__extract_doy + , subq_6.created_at__day + , subq_6.created_at__week + , subq_6.created_at__month + , subq_6.created_at__quarter + , subq_6.created_at__year + , subq_6.created_at__extract_year + , subq_6.created_at__extract_quarter + , subq_6.created_at__extract_month + , subq_6.created_at__extract_day + , subq_6.created_at__extract_dow + , subq_6.created_at__extract_doy + , subq_6.ds_partitioned__day + , subq_6.ds_partitioned__week + , subq_6.ds_partitioned__month + , subq_6.ds_partitioned__quarter + , subq_6.ds_partitioned__year + , subq_6.ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy + , subq_6.last_profile_edit_ts__millisecond + , subq_6.last_profile_edit_ts__second + , subq_6.last_profile_edit_ts__minute + , subq_6.last_profile_edit_ts__hour + , subq_6.last_profile_edit_ts__day + , subq_6.last_profile_edit_ts__week + , subq_6.last_profile_edit_ts__month + , subq_6.last_profile_edit_ts__quarter + , subq_6.last_profile_edit_ts__year + , subq_6.last_profile_edit_ts__extract_year + , subq_6.last_profile_edit_ts__extract_quarter + , subq_6.last_profile_edit_ts__extract_month + , subq_6.last_profile_edit_ts__extract_day + , subq_6.last_profile_edit_ts__extract_dow + , subq_6.last_profile_edit_ts__extract_doy + , subq_6.bio_added_ts__second + , subq_6.bio_added_ts__minute + , subq_6.bio_added_ts__hour + , subq_6.bio_added_ts__day + , subq_6.bio_added_ts__week + , subq_6.bio_added_ts__month + , subq_6.bio_added_ts__quarter + , subq_6.bio_added_ts__year + , subq_6.bio_added_ts__extract_year + , subq_6.bio_added_ts__extract_quarter + , subq_6.bio_added_ts__extract_month + , subq_6.bio_added_ts__extract_day + , subq_6.bio_added_ts__extract_dow + , subq_6.bio_added_ts__extract_doy + , subq_6.last_login_ts__minute + , subq_6.last_login_ts__hour + , subq_6.last_login_ts__day + , subq_6.last_login_ts__week + , subq_6.last_login_ts__month + , subq_6.last_login_ts__quarter + , subq_6.last_login_ts__year + , subq_6.last_login_ts__extract_year + , subq_6.last_login_ts__extract_quarter + , subq_6.last_login_ts__extract_month + , subq_6.last_login_ts__extract_day + , subq_6.last_login_ts__extract_dow + , subq_6.last_login_ts__extract_doy + , subq_6.archived_at__hour + , subq_6.archived_at__day + , subq_6.archived_at__week + , subq_6.archived_at__month + , subq_6.archived_at__quarter + , subq_6.archived_at__year + , subq_6.archived_at__extract_year + , subq_6.archived_at__extract_quarter + , subq_6.archived_at__extract_month + , subq_6.archived_at__extract_day + , subq_6.archived_at__extract_dow + , subq_6.archived_at__extract_doy + , subq_6.user__ds__day + , subq_6.user__ds__week + , subq_6.user__ds__month + , subq_6.user__ds__quarter + , subq_6.user__ds__year + , subq_6.user__ds__extract_year + , subq_6.user__ds__extract_quarter + , subq_6.user__ds__extract_month + , subq_6.user__ds__extract_day + , subq_6.user__ds__extract_dow + , subq_6.user__ds__extract_doy + , subq_6.user__created_at__day + , subq_6.user__created_at__week + , subq_6.user__created_at__month + , subq_6.user__created_at__quarter + , subq_6.user__created_at__year + , subq_6.user__created_at__extract_year + , subq_6.user__created_at__extract_quarter + , subq_6.user__created_at__extract_month + , subq_6.user__created_at__extract_day + , subq_6.user__created_at__extract_dow + , subq_6.user__created_at__extract_doy + , subq_6.user__ds_partitioned__day + , subq_6.user__ds_partitioned__week + , subq_6.user__ds_partitioned__month + , subq_6.user__ds_partitioned__quarter + , subq_6.user__ds_partitioned__year + , subq_6.user__ds_partitioned__extract_year + , subq_6.user__ds_partitioned__extract_quarter + , subq_6.user__ds_partitioned__extract_month + , subq_6.user__ds_partitioned__extract_day + , subq_6.user__ds_partitioned__extract_dow + , subq_6.user__ds_partitioned__extract_doy + , subq_6.user__last_profile_edit_ts__millisecond + , subq_6.user__last_profile_edit_ts__second + , subq_6.user__last_profile_edit_ts__minute + , subq_6.user__last_profile_edit_ts__hour + , subq_6.user__last_profile_edit_ts__day + , subq_6.user__last_profile_edit_ts__week + , subq_6.user__last_profile_edit_ts__month + , subq_6.user__last_profile_edit_ts__quarter + , subq_6.user__last_profile_edit_ts__year + , subq_6.user__last_profile_edit_ts__extract_year + , subq_6.user__last_profile_edit_ts__extract_quarter + , subq_6.user__last_profile_edit_ts__extract_month + , subq_6.user__last_profile_edit_ts__extract_day + , subq_6.user__last_profile_edit_ts__extract_dow + , subq_6.user__last_profile_edit_ts__extract_doy + , subq_6.user__bio_added_ts__second + , subq_6.user__bio_added_ts__minute + , subq_6.user__bio_added_ts__hour + , subq_6.user__bio_added_ts__day + , subq_6.user__bio_added_ts__week + , subq_6.user__bio_added_ts__month + , subq_6.user__bio_added_ts__quarter + , subq_6.user__bio_added_ts__year + , subq_6.user__bio_added_ts__extract_year + , subq_6.user__bio_added_ts__extract_quarter + , subq_6.user__bio_added_ts__extract_month + , subq_6.user__bio_added_ts__extract_day + , subq_6.user__bio_added_ts__extract_dow + , subq_6.user__bio_added_ts__extract_doy + , subq_6.user__last_login_ts__minute + , subq_6.user__last_login_ts__hour + , subq_6.user__last_login_ts__day + , subq_6.user__last_login_ts__week + , subq_6.user__last_login_ts__month + , subq_6.user__last_login_ts__quarter + , subq_6.user__last_login_ts__year + , subq_6.user__last_login_ts__extract_year + , subq_6.user__last_login_ts__extract_quarter + , subq_6.user__last_login_ts__extract_month + , subq_6.user__last_login_ts__extract_day + , subq_6.user__last_login_ts__extract_dow + , subq_6.user__last_login_ts__extract_doy + , subq_6.user__archived_at__hour + , subq_6.user__archived_at__day + , subq_6.user__archived_at__week + , subq_6.user__archived_at__month + , subq_6.user__archived_at__quarter + , subq_6.user__archived_at__year + , subq_6.user__archived_at__extract_year + , subq_6.user__archived_at__extract_quarter + , subq_6.user__archived_at__extract_month + , subq_6.user__archived_at__extract_day + , subq_6.user__archived_at__extract_dow + , subq_6.user__archived_at__extract_doy + , subq_6.metric_time__day + , subq_6.metric_time__week + , subq_6.metric_time__month + , subq_6.metric_time__quarter + , subq_6.metric_time__year + , subq_6.metric_time__extract_year + , subq_6.metric_time__extract_quarter + , subq_6.metric_time__extract_month + , subq_6.metric_time__extract_day + , subq_6.metric_time__extract_dow + , subq_6.metric_time__extract_doy + , subq_6.user + , subq_6.home_state + , subq_6.user__home_state + FROM ( + -- Metric Time Dimension 'created_at' + SELECT + subq_5.ds__day + , subq_5.ds__week + , subq_5.ds__month + , subq_5.ds__quarter + , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_day + , subq_5.ds__extract_dow + , subq_5.ds__extract_doy + , subq_5.created_at__day + , subq_5.created_at__week + , subq_5.created_at__month + , subq_5.created_at__quarter + , subq_5.created_at__year + , subq_5.created_at__extract_year + , subq_5.created_at__extract_quarter + , subq_5.created_at__extract_month + , subq_5.created_at__extract_day + , subq_5.created_at__extract_dow + , subq_5.created_at__extract_doy + , subq_5.ds_partitioned__day + , subq_5.ds_partitioned__week + , subq_5.ds_partitioned__month + , subq_5.ds_partitioned__quarter + , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dow + , subq_5.ds_partitioned__extract_doy + , subq_5.last_profile_edit_ts__millisecond + , subq_5.last_profile_edit_ts__second + , subq_5.last_profile_edit_ts__minute + , subq_5.last_profile_edit_ts__hour + , subq_5.last_profile_edit_ts__day + , subq_5.last_profile_edit_ts__week + , subq_5.last_profile_edit_ts__month + , subq_5.last_profile_edit_ts__quarter + , subq_5.last_profile_edit_ts__year + , subq_5.last_profile_edit_ts__extract_year + , subq_5.last_profile_edit_ts__extract_quarter + , subq_5.last_profile_edit_ts__extract_month + , subq_5.last_profile_edit_ts__extract_day + , subq_5.last_profile_edit_ts__extract_dow + , subq_5.last_profile_edit_ts__extract_doy + , subq_5.bio_added_ts__second + , subq_5.bio_added_ts__minute + , subq_5.bio_added_ts__hour + , subq_5.bio_added_ts__day + , subq_5.bio_added_ts__week + , subq_5.bio_added_ts__month + , subq_5.bio_added_ts__quarter + , subq_5.bio_added_ts__year + , subq_5.bio_added_ts__extract_year + , subq_5.bio_added_ts__extract_quarter + , subq_5.bio_added_ts__extract_month + , subq_5.bio_added_ts__extract_day + , subq_5.bio_added_ts__extract_dow + , subq_5.bio_added_ts__extract_doy + , subq_5.last_login_ts__minute + , subq_5.last_login_ts__hour + , subq_5.last_login_ts__day + , subq_5.last_login_ts__week + , subq_5.last_login_ts__month + , subq_5.last_login_ts__quarter + , subq_5.last_login_ts__year + , subq_5.last_login_ts__extract_year + , subq_5.last_login_ts__extract_quarter + , subq_5.last_login_ts__extract_month + , subq_5.last_login_ts__extract_day + , subq_5.last_login_ts__extract_dow + , subq_5.last_login_ts__extract_doy + , subq_5.archived_at__hour + , subq_5.archived_at__day + , subq_5.archived_at__week + , subq_5.archived_at__month + , subq_5.archived_at__quarter + , subq_5.archived_at__year + , subq_5.archived_at__extract_year + , subq_5.archived_at__extract_quarter + , subq_5.archived_at__extract_month + , subq_5.archived_at__extract_day + , subq_5.archived_at__extract_dow + , subq_5.archived_at__extract_doy + , subq_5.user__ds__day + , subq_5.user__ds__week + , subq_5.user__ds__month + , subq_5.user__ds__quarter + , subq_5.user__ds__year + , subq_5.user__ds__extract_year + , subq_5.user__ds__extract_quarter + , subq_5.user__ds__extract_month + , subq_5.user__ds__extract_day + , subq_5.user__ds__extract_dow + , subq_5.user__ds__extract_doy + , subq_5.user__created_at__day + , subq_5.user__created_at__week + , subq_5.user__created_at__month + , subq_5.user__created_at__quarter + , subq_5.user__created_at__year + , subq_5.user__created_at__extract_year + , subq_5.user__created_at__extract_quarter + , subq_5.user__created_at__extract_month + , subq_5.user__created_at__extract_day + , subq_5.user__created_at__extract_dow + , subq_5.user__created_at__extract_doy + , subq_5.user__ds_partitioned__day + , subq_5.user__ds_partitioned__week + , subq_5.user__ds_partitioned__month + , subq_5.user__ds_partitioned__quarter + , subq_5.user__ds_partitioned__year + , subq_5.user__ds_partitioned__extract_year + , subq_5.user__ds_partitioned__extract_quarter + , subq_5.user__ds_partitioned__extract_month + , subq_5.user__ds_partitioned__extract_day + , subq_5.user__ds_partitioned__extract_dow + , subq_5.user__ds_partitioned__extract_doy + , subq_5.user__last_profile_edit_ts__millisecond + , subq_5.user__last_profile_edit_ts__second + , subq_5.user__last_profile_edit_ts__minute + , subq_5.user__last_profile_edit_ts__hour + , subq_5.user__last_profile_edit_ts__day + , subq_5.user__last_profile_edit_ts__week + , subq_5.user__last_profile_edit_ts__month + , subq_5.user__last_profile_edit_ts__quarter + , subq_5.user__last_profile_edit_ts__year + , subq_5.user__last_profile_edit_ts__extract_year + , subq_5.user__last_profile_edit_ts__extract_quarter + , subq_5.user__last_profile_edit_ts__extract_month + , subq_5.user__last_profile_edit_ts__extract_day + , subq_5.user__last_profile_edit_ts__extract_dow + , subq_5.user__last_profile_edit_ts__extract_doy + , subq_5.user__bio_added_ts__second + , subq_5.user__bio_added_ts__minute + , subq_5.user__bio_added_ts__hour + , subq_5.user__bio_added_ts__day + , subq_5.user__bio_added_ts__week + , subq_5.user__bio_added_ts__month + , subq_5.user__bio_added_ts__quarter + , subq_5.user__bio_added_ts__year + , subq_5.user__bio_added_ts__extract_year + , subq_5.user__bio_added_ts__extract_quarter + , subq_5.user__bio_added_ts__extract_month + , subq_5.user__bio_added_ts__extract_day + , subq_5.user__bio_added_ts__extract_dow + , subq_5.user__bio_added_ts__extract_doy + , subq_5.user__last_login_ts__minute + , subq_5.user__last_login_ts__hour + , subq_5.user__last_login_ts__day + , subq_5.user__last_login_ts__week + , subq_5.user__last_login_ts__month + , subq_5.user__last_login_ts__quarter + , subq_5.user__last_login_ts__year + , subq_5.user__last_login_ts__extract_year + , subq_5.user__last_login_ts__extract_quarter + , subq_5.user__last_login_ts__extract_month + , subq_5.user__last_login_ts__extract_day + , subq_5.user__last_login_ts__extract_dow + , subq_5.user__last_login_ts__extract_doy + , subq_5.user__archived_at__hour + , subq_5.user__archived_at__day + , subq_5.user__archived_at__week + , subq_5.user__archived_at__month + , subq_5.user__archived_at__quarter + , subq_5.user__archived_at__year + , subq_5.user__archived_at__extract_year + , subq_5.user__archived_at__extract_quarter + , subq_5.user__archived_at__extract_month + , subq_5.user__archived_at__extract_day + , subq_5.user__archived_at__extract_dow + , subq_5.user__archived_at__extract_doy + , subq_5.created_at__day AS metric_time__day + , subq_5.created_at__week AS metric_time__week + , subq_5.created_at__month AS metric_time__month + , subq_5.created_at__quarter AS metric_time__quarter + , subq_5.created_at__year AS metric_time__year + , subq_5.created_at__extract_year AS metric_time__extract_year + , subq_5.created_at__extract_quarter AS metric_time__extract_quarter + , subq_5.created_at__extract_month AS metric_time__extract_month + , subq_5.created_at__extract_day AS metric_time__extract_day + , subq_5.created_at__extract_dow AS metric_time__extract_dow + , subq_5.created_at__extract_doy AS metric_time__extract_doy + , subq_5.user + , subq_5.home_state + , subq_5.user__home_state + , subq_5.new_users + FROM ( + -- Read Elements From Semantic Model 'users_ds_source' + SELECT + 1 AS new_users + , DATETIME_TRUNC(users_ds_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(users_ds_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(users_ds_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(users_ds_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.ds, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.ds) AS ds__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.created_at) AS created_at__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy + , users_ds_source_src_28000.home_state + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, millisecond) AS last_profile_edit_ts__millisecond + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, second) AS last_profile_edit_ts__second + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, minute) AS last_profile_edit_ts__minute + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, hour) AS last_profile_edit_ts__hour + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, day) AS last_profile_edit_ts__day + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, isoweek) AS last_profile_edit_ts__week + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, month) AS last_profile_edit_ts__month + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, quarter) AS last_profile_edit_ts__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.last_profile_edit_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.last_profile_edit_ts) - 1) AS last_profile_edit_ts__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.last_profile_edit_ts) AS last_profile_edit_ts__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, second) AS bio_added_ts__second + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, minute) AS bio_added_ts__minute + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, hour) AS bio_added_ts__hour + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, day) AS bio_added_ts__day + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, isoweek) AS bio_added_ts__week + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, month) AS bio_added_ts__month + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, quarter) AS bio_added_ts__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.bio_added_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.bio_added_ts) - 1) AS bio_added_ts__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.bio_added_ts) AS bio_added_ts__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, minute) AS last_login_ts__minute + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, hour) AS last_login_ts__hour + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, day) AS last_login_ts__day + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, isoweek) AS last_login_ts__week + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, month) AS last_login_ts__month + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, quarter) AS last_login_ts__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.last_login_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.last_login_ts) - 1) AS last_login_ts__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.last_login_ts) AS last_login_ts__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, hour) AS archived_at__hour + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, day) AS archived_at__day + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, isoweek) AS archived_at__week + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, month) AS archived_at__month + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, quarter) AS archived_at__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.archived_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.archived_at) - 1) AS archived_at__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.archived_at) AS archived_at__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.ds, day) AS user__ds__day + , DATETIME_TRUNC(users_ds_source_src_28000.ds, isoweek) AS user__ds__week + , DATETIME_TRUNC(users_ds_source_src_28000.ds, month) AS user__ds__month + , DATETIME_TRUNC(users_ds_source_src_28000.ds, quarter) AS user__ds__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.ds, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.ds) - 1) AS user__ds__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.ds) AS user__ds__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, day) AS user__created_at__day + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, isoweek) AS user__created_at__week + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, month) AS user__created_at__month + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, quarter) AS user__created_at__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.created_at) - 1) AS user__created_at__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.created_at) AS user__created_at__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, day) AS user__ds_partitioned__day + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, isoweek) AS user__ds_partitioned__week + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, month) AS user__ds_partitioned__month + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, quarter) AS user__ds_partitioned__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.ds_partitioned) - 1) AS user__ds_partitioned__extract_dow + , EXTRACT(dayofyear 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 + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, millisecond) AS user__last_profile_edit_ts__millisecond + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, second) AS user__last_profile_edit_ts__second + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, minute) AS user__last_profile_edit_ts__minute + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, hour) AS user__last_profile_edit_ts__hour + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, day) AS user__last_profile_edit_ts__day + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, isoweek) AS user__last_profile_edit_ts__week + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, month) AS user__last_profile_edit_ts__month + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, quarter) AS user__last_profile_edit_ts__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.last_profile_edit_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.last_profile_edit_ts) - 1) AS user__last_profile_edit_ts__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.last_profile_edit_ts) AS user__last_profile_edit_ts__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, second) AS user__bio_added_ts__second + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, minute) AS user__bio_added_ts__minute + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, hour) AS user__bio_added_ts__hour + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, day) AS user__bio_added_ts__day + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, isoweek) AS user__bio_added_ts__week + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, month) AS user__bio_added_ts__month + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, quarter) AS user__bio_added_ts__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.bio_added_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.bio_added_ts) - 1) AS user__bio_added_ts__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.bio_added_ts) AS user__bio_added_ts__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, minute) AS user__last_login_ts__minute + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, hour) AS user__last_login_ts__hour + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, day) AS user__last_login_ts__day + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, isoweek) AS user__last_login_ts__week + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, month) AS user__last_login_ts__month + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, quarter) AS user__last_login_ts__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.last_login_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.last_login_ts) - 1) AS user__last_login_ts__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.last_login_ts) AS user__last_login_ts__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, hour) AS user__archived_at__hour + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, day) AS user__archived_at__day + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, isoweek) AS user__archived_at__week + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, month) AS user__archived_at__month + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, quarter) AS user__archived_at__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.archived_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.archived_at) - 1) AS user__archived_at__extract_dow + , EXTRACT(dayofyear 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_5 + ) subq_6 + ) subq_7 + ON + subq_4.user = subq_7.user + ) subq_8 + ) subq_9 + ON + ( + subq_2.listing = subq_9.listing + ) AND ( + subq_2.ds_partitioned__day = subq_9.user__ds_partitioned__day + ) + ) subq_10 + ) subq_11 + GROUP BY + listing__user__bio_added_ts__minute +) subq_12 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql new file mode 100644 index 0000000000..fdcb7133a2 --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql @@ -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 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_metric_with_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_metric_with_sub_daily_dimension__plan0.sql new file mode 100644 index 0000000000..8d50d7a38a --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_metric_with_sub_daily_dimension__plan0.sql @@ -0,0 +1,394 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.user__archived_at__hour + , subq_3.new_users +FROM ( + -- Aggregate Measures + SELECT + subq_2.user__archived_at__hour + , SUM(subq_2.new_users) AS new_users + FROM ( + -- Pass Only Elements: ['new_users', 'user__archived_at__hour'] + SELECT + subq_1.user__archived_at__hour + , subq_1.new_users + FROM ( + -- Metric Time Dimension 'created_at' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.created_at__day + , subq_0.created_at__week + , subq_0.created_at__month + , subq_0.created_at__quarter + , subq_0.created_at__year + , subq_0.created_at__extract_year + , subq_0.created_at__extract_quarter + , subq_0.created_at__extract_month + , subq_0.created_at__extract_day + , subq_0.created_at__extract_dow + , subq_0.created_at__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.last_profile_edit_ts__millisecond + , subq_0.last_profile_edit_ts__second + , subq_0.last_profile_edit_ts__minute + , subq_0.last_profile_edit_ts__hour + , subq_0.last_profile_edit_ts__day + , subq_0.last_profile_edit_ts__week + , subq_0.last_profile_edit_ts__month + , subq_0.last_profile_edit_ts__quarter + , subq_0.last_profile_edit_ts__year + , subq_0.last_profile_edit_ts__extract_year + , subq_0.last_profile_edit_ts__extract_quarter + , subq_0.last_profile_edit_ts__extract_month + , subq_0.last_profile_edit_ts__extract_day + , subq_0.last_profile_edit_ts__extract_dow + , subq_0.last_profile_edit_ts__extract_doy + , subq_0.bio_added_ts__second + , subq_0.bio_added_ts__minute + , subq_0.bio_added_ts__hour + , subq_0.bio_added_ts__day + , subq_0.bio_added_ts__week + , subq_0.bio_added_ts__month + , subq_0.bio_added_ts__quarter + , subq_0.bio_added_ts__year + , subq_0.bio_added_ts__extract_year + , subq_0.bio_added_ts__extract_quarter + , subq_0.bio_added_ts__extract_month + , subq_0.bio_added_ts__extract_day + , subq_0.bio_added_ts__extract_dow + , subq_0.bio_added_ts__extract_doy + , subq_0.last_login_ts__minute + , subq_0.last_login_ts__hour + , subq_0.last_login_ts__day + , subq_0.last_login_ts__week + , subq_0.last_login_ts__month + , subq_0.last_login_ts__quarter + , subq_0.last_login_ts__year + , subq_0.last_login_ts__extract_year + , subq_0.last_login_ts__extract_quarter + , subq_0.last_login_ts__extract_month + , subq_0.last_login_ts__extract_day + , subq_0.last_login_ts__extract_dow + , subq_0.last_login_ts__extract_doy + , subq_0.archived_at__hour + , subq_0.archived_at__day + , subq_0.archived_at__week + , subq_0.archived_at__month + , subq_0.archived_at__quarter + , subq_0.archived_at__year + , subq_0.archived_at__extract_year + , subq_0.archived_at__extract_quarter + , subq_0.archived_at__extract_month + , subq_0.archived_at__extract_day + , subq_0.archived_at__extract_dow + , subq_0.archived_at__extract_doy + , subq_0.user__ds__day + , subq_0.user__ds__week + , subq_0.user__ds__month + , subq_0.user__ds__quarter + , subq_0.user__ds__year + , subq_0.user__ds__extract_year + , subq_0.user__ds__extract_quarter + , subq_0.user__ds__extract_month + , subq_0.user__ds__extract_day + , subq_0.user__ds__extract_dow + , subq_0.user__ds__extract_doy + , subq_0.user__created_at__day + , subq_0.user__created_at__week + , subq_0.user__created_at__month + , subq_0.user__created_at__quarter + , subq_0.user__created_at__year + , subq_0.user__created_at__extract_year + , subq_0.user__created_at__extract_quarter + , subq_0.user__created_at__extract_month + , subq_0.user__created_at__extract_day + , subq_0.user__created_at__extract_dow + , subq_0.user__created_at__extract_doy + , subq_0.user__ds_partitioned__day + , subq_0.user__ds_partitioned__week + , subq_0.user__ds_partitioned__month + , subq_0.user__ds_partitioned__quarter + , subq_0.user__ds_partitioned__year + , subq_0.user__ds_partitioned__extract_year + , subq_0.user__ds_partitioned__extract_quarter + , subq_0.user__ds_partitioned__extract_month + , subq_0.user__ds_partitioned__extract_day + , subq_0.user__ds_partitioned__extract_dow + , subq_0.user__ds_partitioned__extract_doy + , subq_0.user__last_profile_edit_ts__millisecond + , subq_0.user__last_profile_edit_ts__second + , subq_0.user__last_profile_edit_ts__minute + , subq_0.user__last_profile_edit_ts__hour + , subq_0.user__last_profile_edit_ts__day + , subq_0.user__last_profile_edit_ts__week + , subq_0.user__last_profile_edit_ts__month + , subq_0.user__last_profile_edit_ts__quarter + , subq_0.user__last_profile_edit_ts__year + , subq_0.user__last_profile_edit_ts__extract_year + , subq_0.user__last_profile_edit_ts__extract_quarter + , subq_0.user__last_profile_edit_ts__extract_month + , subq_0.user__last_profile_edit_ts__extract_day + , subq_0.user__last_profile_edit_ts__extract_dow + , subq_0.user__last_profile_edit_ts__extract_doy + , subq_0.user__bio_added_ts__second + , subq_0.user__bio_added_ts__minute + , subq_0.user__bio_added_ts__hour + , subq_0.user__bio_added_ts__day + , subq_0.user__bio_added_ts__week + , subq_0.user__bio_added_ts__month + , subq_0.user__bio_added_ts__quarter + , subq_0.user__bio_added_ts__year + , subq_0.user__bio_added_ts__extract_year + , subq_0.user__bio_added_ts__extract_quarter + , subq_0.user__bio_added_ts__extract_month + , subq_0.user__bio_added_ts__extract_day + , subq_0.user__bio_added_ts__extract_dow + , subq_0.user__bio_added_ts__extract_doy + , subq_0.user__last_login_ts__minute + , subq_0.user__last_login_ts__hour + , subq_0.user__last_login_ts__day + , subq_0.user__last_login_ts__week + , subq_0.user__last_login_ts__month + , subq_0.user__last_login_ts__quarter + , subq_0.user__last_login_ts__year + , subq_0.user__last_login_ts__extract_year + , subq_0.user__last_login_ts__extract_quarter + , subq_0.user__last_login_ts__extract_month + , subq_0.user__last_login_ts__extract_day + , subq_0.user__last_login_ts__extract_dow + , subq_0.user__last_login_ts__extract_doy + , subq_0.user__archived_at__hour + , subq_0.user__archived_at__day + , subq_0.user__archived_at__week + , subq_0.user__archived_at__month + , subq_0.user__archived_at__quarter + , subq_0.user__archived_at__year + , subq_0.user__archived_at__extract_year + , subq_0.user__archived_at__extract_quarter + , subq_0.user__archived_at__extract_month + , subq_0.user__archived_at__extract_day + , subq_0.user__archived_at__extract_dow + , subq_0.user__archived_at__extract_doy + , subq_0.created_at__day AS metric_time__day + , subq_0.created_at__week AS metric_time__week + , subq_0.created_at__month AS metric_time__month + , subq_0.created_at__quarter AS metric_time__quarter + , subq_0.created_at__year AS metric_time__year + , subq_0.created_at__extract_year AS metric_time__extract_year + , subq_0.created_at__extract_quarter AS metric_time__extract_quarter + , subq_0.created_at__extract_month AS metric_time__extract_month + , subq_0.created_at__extract_day AS metric_time__extract_day + , subq_0.created_at__extract_dow AS metric_time__extract_dow + , subq_0.created_at__extract_doy AS metric_time__extract_doy + , subq_0.user + , subq_0.home_state + , subq_0.user__home_state + , subq_0.new_users + FROM ( + -- Read Elements From Semantic Model 'users_ds_source' + SELECT + 1 AS new_users + , DATETIME_TRUNC(users_ds_source_src_28000.ds, day) AS ds__day + , DATETIME_TRUNC(users_ds_source_src_28000.ds, isoweek) AS ds__week + , DATETIME_TRUNC(users_ds_source_src_28000.ds, month) AS ds__month + , DATETIME_TRUNC(users_ds_source_src_28000.ds, quarter) AS ds__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.ds, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.ds) - 1) AS ds__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.ds) AS ds__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, day) AS created_at__day + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, isoweek) AS created_at__week + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, month) AS created_at__month + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, quarter) AS created_at__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.created_at) - 1) AS created_at__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.created_at) AS created_at__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, day) AS ds_partitioned__day + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, isoweek) AS ds_partitioned__week + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, month) AS ds_partitioned__month + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, quarter) AS ds_partitioned__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.ds_partitioned) - 1) AS ds_partitioned__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy + , users_ds_source_src_28000.home_state + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, millisecond) AS last_profile_edit_ts__millisecond + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, second) AS last_profile_edit_ts__second + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, minute) AS last_profile_edit_ts__minute + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, hour) AS last_profile_edit_ts__hour + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, day) AS last_profile_edit_ts__day + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, isoweek) AS last_profile_edit_ts__week + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, month) AS last_profile_edit_ts__month + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, quarter) AS last_profile_edit_ts__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.last_profile_edit_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.last_profile_edit_ts) - 1) AS last_profile_edit_ts__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.last_profile_edit_ts) AS last_profile_edit_ts__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, second) AS bio_added_ts__second + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, minute) AS bio_added_ts__minute + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, hour) AS bio_added_ts__hour + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, day) AS bio_added_ts__day + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, isoweek) AS bio_added_ts__week + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, month) AS bio_added_ts__month + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, quarter) AS bio_added_ts__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.bio_added_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.bio_added_ts) - 1) AS bio_added_ts__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.bio_added_ts) AS bio_added_ts__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, minute) AS last_login_ts__minute + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, hour) AS last_login_ts__hour + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, day) AS last_login_ts__day + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, isoweek) AS last_login_ts__week + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, month) AS last_login_ts__month + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, quarter) AS last_login_ts__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.last_login_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.last_login_ts) - 1) AS last_login_ts__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.last_login_ts) AS last_login_ts__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, hour) AS archived_at__hour + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, day) AS archived_at__day + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, isoweek) AS archived_at__week + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, month) AS archived_at__month + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, quarter) AS archived_at__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.archived_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.archived_at) - 1) AS archived_at__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.archived_at) AS archived_at__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.ds, day) AS user__ds__day + , DATETIME_TRUNC(users_ds_source_src_28000.ds, isoweek) AS user__ds__week + , DATETIME_TRUNC(users_ds_source_src_28000.ds, month) AS user__ds__month + , DATETIME_TRUNC(users_ds_source_src_28000.ds, quarter) AS user__ds__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.ds, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.ds) - 1) AS user__ds__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.ds) AS user__ds__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, day) AS user__created_at__day + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, isoweek) AS user__created_at__week + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, month) AS user__created_at__month + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, quarter) AS user__created_at__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.created_at, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.created_at) - 1) AS user__created_at__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.created_at) AS user__created_at__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, day) AS user__ds_partitioned__day + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, isoweek) AS user__ds_partitioned__week + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, month) AS user__ds_partitioned__month + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, quarter) AS user__ds_partitioned__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.ds_partitioned, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.ds_partitioned) - 1) AS user__ds_partitioned__extract_dow + , EXTRACT(dayofyear 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 + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, millisecond) AS user__last_profile_edit_ts__millisecond + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, second) AS user__last_profile_edit_ts__second + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, minute) AS user__last_profile_edit_ts__minute + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, hour) AS user__last_profile_edit_ts__hour + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, day) AS user__last_profile_edit_ts__day + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, isoweek) AS user__last_profile_edit_ts__week + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, month) AS user__last_profile_edit_ts__month + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, quarter) AS user__last_profile_edit_ts__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.last_profile_edit_ts, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.last_profile_edit_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.last_profile_edit_ts) - 1) AS user__last_profile_edit_ts__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.last_profile_edit_ts) AS user__last_profile_edit_ts__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, second) AS user__bio_added_ts__second + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, minute) AS user__bio_added_ts__minute + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, hour) AS user__bio_added_ts__hour + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, day) AS user__bio_added_ts__day + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, isoweek) AS user__bio_added_ts__week + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, month) AS user__bio_added_ts__month + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, quarter) AS user__bio_added_ts__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.bio_added_ts, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.bio_added_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.bio_added_ts) - 1) AS user__bio_added_ts__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.bio_added_ts) AS user__bio_added_ts__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, minute) AS user__last_login_ts__minute + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, hour) AS user__last_login_ts__hour + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, day) AS user__last_login_ts__day + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, isoweek) AS user__last_login_ts__week + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, month) AS user__last_login_ts__month + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, quarter) AS user__last_login_ts__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.last_login_ts, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.last_login_ts) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.last_login_ts) - 1) AS user__last_login_ts__extract_dow + , EXTRACT(dayofyear FROM users_ds_source_src_28000.last_login_ts) AS user__last_login_ts__extract_doy + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, hour) AS user__archived_at__hour + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, day) AS user__archived_at__day + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, isoweek) AS user__archived_at__week + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, month) AS user__archived_at__month + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, quarter) AS user__archived_at__quarter + , DATETIME_TRUNC(users_ds_source_src_28000.archived_at, year) 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 + , IF(EXTRACT(dayofweek FROM users_ds_source_src_28000.archived_at) = 1, 7, EXTRACT(dayofweek FROM users_ds_source_src_28000.archived_at) - 1) AS user__archived_at__extract_dow + , EXTRACT(dayofyear 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 + ) subq_1 + ) subq_2 + GROUP BY + user__archived_at__hour +) subq_3 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql new file mode 100644 index 0000000000..b48135ac21 --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql @@ -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 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql new file mode 100644 index 0000000000..1eff3f6090 --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql @@ -0,0 +1,1303 @@ +-- Compute Metrics via Expressions +SELECT + subq_12.listing__user__bio_added_ts__minute + , subq_12.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_11.listing__user__bio_added_ts__minute + , SUM(subq_11.bookings) AS bookings + FROM ( + -- Pass Only Elements: ['bookings', 'listing__user__bio_added_ts__minute'] + SELECT + subq_10.listing__user__bio_added_ts__minute + , subq_10.bookings + FROM ( + -- Join Standard Outputs + SELECT + subq_2.ds_partitioned__day AS ds_partitioned__day + , subq_9.user__ds_partitioned__day AS listing__user__ds_partitioned__day + , subq_9.user__bio_added_ts__minute AS listing__user__bio_added_ts__minute + , subq_2.listing AS listing + , subq_2.bookings AS bookings + FROM ( + -- Pass Only Elements: ['bookings', 'ds_partitioned__day', 'listing'] + SELECT + subq_1.ds_partitioned__day + , subq_1.listing + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_28000.booking_value + , bookings_source_src_28000.booking_value AS max_booking_value + , bookings_source_src_28000.booking_value AS min_booking_value + , bookings_source_src_28000.guest_id AS bookers + , bookings_source_src_28000.booking_value AS average_booking_value + , bookings_source_src_28000.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_28000.booking_value AS median_booking_value + , bookings_source_src_28000.booking_value AS booking_value_p99 + , bookings_source_src_28000.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28000.is_instant + , DATE_TRUNC('day', bookings_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy + , bookings_source_src_28000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28000.listing_id AS listing + , bookings_source_src_28000.guest_id AS guest + , bookings_source_src_28000.host_id AS host + , bookings_source_src_28000.listing_id AS booking__listing + , bookings_source_src_28000.guest_id AS booking__guest + , bookings_source_src_28000.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28000 + ) subq_0 + ) subq_1 + ) subq_2 + LEFT OUTER JOIN ( + -- Pass Only Elements: ['user__ds_partitioned__day', 'user__bio_added_ts__minute', 'listing'] + SELECT + subq_8.user__ds_partitioned__day + , subq_8.user__bio_added_ts__minute + , subq_8.listing + FROM ( + -- Join Standard Outputs + SELECT + subq_4.ds__day AS ds__day + , subq_4.ds__week AS ds__week + , subq_4.ds__month AS ds__month + , subq_4.ds__quarter AS ds__quarter + , subq_4.ds__year AS ds__year + , subq_4.ds__extract_year AS ds__extract_year + , subq_4.ds__extract_quarter AS ds__extract_quarter + , subq_4.ds__extract_month AS ds__extract_month + , subq_4.ds__extract_day AS ds__extract_day + , subq_4.ds__extract_dow AS ds__extract_dow + , subq_4.ds__extract_doy AS ds__extract_doy + , subq_4.created_at__day AS created_at__day + , subq_4.created_at__week AS created_at__week + , subq_4.created_at__month AS created_at__month + , subq_4.created_at__quarter AS created_at__quarter + , subq_4.created_at__year AS created_at__year + , subq_4.created_at__extract_year AS created_at__extract_year + , subq_4.created_at__extract_quarter AS created_at__extract_quarter + , subq_4.created_at__extract_month AS created_at__extract_month + , subq_4.created_at__extract_day AS created_at__extract_day + , subq_4.created_at__extract_dow AS created_at__extract_dow + , subq_4.created_at__extract_doy AS created_at__extract_doy + , subq_4.listing__ds__day AS listing__ds__day + , subq_4.listing__ds__week AS listing__ds__week + , subq_4.listing__ds__month AS listing__ds__month + , subq_4.listing__ds__quarter AS listing__ds__quarter + , subq_4.listing__ds__year AS listing__ds__year + , subq_4.listing__ds__extract_year AS listing__ds__extract_year + , subq_4.listing__ds__extract_quarter AS listing__ds__extract_quarter + , subq_4.listing__ds__extract_month AS listing__ds__extract_month + , subq_4.listing__ds__extract_day AS listing__ds__extract_day + , subq_4.listing__ds__extract_dow AS listing__ds__extract_dow + , subq_4.listing__ds__extract_doy AS listing__ds__extract_doy + , subq_4.listing__created_at__day AS listing__created_at__day + , subq_4.listing__created_at__week AS listing__created_at__week + , subq_4.listing__created_at__month AS listing__created_at__month + , subq_4.listing__created_at__quarter AS listing__created_at__quarter + , subq_4.listing__created_at__year AS listing__created_at__year + , subq_4.listing__created_at__extract_year AS listing__created_at__extract_year + , subq_4.listing__created_at__extract_quarter AS listing__created_at__extract_quarter + , subq_4.listing__created_at__extract_month AS listing__created_at__extract_month + , subq_4.listing__created_at__extract_day AS listing__created_at__extract_day + , subq_4.listing__created_at__extract_dow AS listing__created_at__extract_dow + , subq_4.listing__created_at__extract_doy AS listing__created_at__extract_doy + , subq_4.metric_time__day AS metric_time__day + , 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_7.ds__day AS user__ds__day + , subq_7.ds__week AS user__ds__week + , subq_7.ds__month AS user__ds__month + , subq_7.ds__quarter AS user__ds__quarter + , subq_7.ds__year AS user__ds__year + , subq_7.ds__extract_year AS user__ds__extract_year + , subq_7.ds__extract_quarter AS user__ds__extract_quarter + , subq_7.ds__extract_month AS user__ds__extract_month + , subq_7.ds__extract_day AS user__ds__extract_day + , subq_7.ds__extract_dow AS user__ds__extract_dow + , subq_7.ds__extract_doy AS user__ds__extract_doy + , subq_7.created_at__day AS user__created_at__day + , subq_7.created_at__week AS user__created_at__week + , subq_7.created_at__month AS user__created_at__month + , subq_7.created_at__quarter AS user__created_at__quarter + , subq_7.created_at__year AS user__created_at__year + , subq_7.created_at__extract_year AS user__created_at__extract_year + , subq_7.created_at__extract_quarter AS user__created_at__extract_quarter + , subq_7.created_at__extract_month AS user__created_at__extract_month + , subq_7.created_at__extract_day AS user__created_at__extract_day + , subq_7.created_at__extract_dow AS user__created_at__extract_dow + , subq_7.created_at__extract_doy AS user__created_at__extract_doy + , subq_7.ds_partitioned__day AS user__ds_partitioned__day + , subq_7.ds_partitioned__week AS user__ds_partitioned__week + , subq_7.ds_partitioned__month AS user__ds_partitioned__month + , subq_7.ds_partitioned__quarter AS user__ds_partitioned__quarter + , subq_7.ds_partitioned__year AS user__ds_partitioned__year + , subq_7.ds_partitioned__extract_year AS user__ds_partitioned__extract_year + , subq_7.ds_partitioned__extract_quarter AS user__ds_partitioned__extract_quarter + , subq_7.ds_partitioned__extract_month AS user__ds_partitioned__extract_month + , subq_7.ds_partitioned__extract_day AS user__ds_partitioned__extract_day + , subq_7.ds_partitioned__extract_dow AS user__ds_partitioned__extract_dow + , subq_7.ds_partitioned__extract_doy AS user__ds_partitioned__extract_doy + , subq_7.last_profile_edit_ts__millisecond AS user__last_profile_edit_ts__millisecond + , subq_7.last_profile_edit_ts__second AS user__last_profile_edit_ts__second + , subq_7.last_profile_edit_ts__minute AS user__last_profile_edit_ts__minute + , subq_7.last_profile_edit_ts__hour AS user__last_profile_edit_ts__hour + , subq_7.last_profile_edit_ts__day AS user__last_profile_edit_ts__day + , subq_7.last_profile_edit_ts__week AS user__last_profile_edit_ts__week + , subq_7.last_profile_edit_ts__month AS user__last_profile_edit_ts__month + , subq_7.last_profile_edit_ts__quarter AS user__last_profile_edit_ts__quarter + , subq_7.last_profile_edit_ts__year AS user__last_profile_edit_ts__year + , subq_7.last_profile_edit_ts__extract_year AS user__last_profile_edit_ts__extract_year + , subq_7.last_profile_edit_ts__extract_quarter AS user__last_profile_edit_ts__extract_quarter + , subq_7.last_profile_edit_ts__extract_month AS user__last_profile_edit_ts__extract_month + , subq_7.last_profile_edit_ts__extract_day AS user__last_profile_edit_ts__extract_day + , subq_7.last_profile_edit_ts__extract_dow AS user__last_profile_edit_ts__extract_dow + , subq_7.last_profile_edit_ts__extract_doy AS user__last_profile_edit_ts__extract_doy + , subq_7.bio_added_ts__second AS user__bio_added_ts__second + , subq_7.bio_added_ts__minute AS user__bio_added_ts__minute + , subq_7.bio_added_ts__hour AS user__bio_added_ts__hour + , subq_7.bio_added_ts__day AS user__bio_added_ts__day + , subq_7.bio_added_ts__week AS user__bio_added_ts__week + , subq_7.bio_added_ts__month AS user__bio_added_ts__month + , subq_7.bio_added_ts__quarter AS user__bio_added_ts__quarter + , subq_7.bio_added_ts__year AS user__bio_added_ts__year + , subq_7.bio_added_ts__extract_year AS user__bio_added_ts__extract_year + , subq_7.bio_added_ts__extract_quarter AS user__bio_added_ts__extract_quarter + , subq_7.bio_added_ts__extract_month AS user__bio_added_ts__extract_month + , subq_7.bio_added_ts__extract_day AS user__bio_added_ts__extract_day + , subq_7.bio_added_ts__extract_dow AS user__bio_added_ts__extract_dow + , subq_7.bio_added_ts__extract_doy AS user__bio_added_ts__extract_doy + , subq_7.last_login_ts__minute AS user__last_login_ts__minute + , subq_7.last_login_ts__hour AS user__last_login_ts__hour + , subq_7.last_login_ts__day AS user__last_login_ts__day + , subq_7.last_login_ts__week AS user__last_login_ts__week + , subq_7.last_login_ts__month AS user__last_login_ts__month + , subq_7.last_login_ts__quarter AS user__last_login_ts__quarter + , subq_7.last_login_ts__year AS user__last_login_ts__year + , subq_7.last_login_ts__extract_year AS user__last_login_ts__extract_year + , subq_7.last_login_ts__extract_quarter AS user__last_login_ts__extract_quarter + , subq_7.last_login_ts__extract_month AS user__last_login_ts__extract_month + , subq_7.last_login_ts__extract_day AS user__last_login_ts__extract_day + , subq_7.last_login_ts__extract_dow AS user__last_login_ts__extract_dow + , subq_7.last_login_ts__extract_doy AS user__last_login_ts__extract_doy + , subq_7.archived_at__hour AS user__archived_at__hour + , subq_7.archived_at__day AS user__archived_at__day + , subq_7.archived_at__week AS user__archived_at__week + , subq_7.archived_at__month AS user__archived_at__month + , subq_7.archived_at__quarter AS user__archived_at__quarter + , subq_7.archived_at__year AS user__archived_at__year + , subq_7.archived_at__extract_year AS user__archived_at__extract_year + , subq_7.archived_at__extract_quarter AS user__archived_at__extract_quarter + , subq_7.archived_at__extract_month AS user__archived_at__extract_month + , subq_7.archived_at__extract_day AS user__archived_at__extract_day + , subq_7.archived_at__extract_dow AS user__archived_at__extract_dow + , subq_7.archived_at__extract_doy AS user__archived_at__extract_doy + , subq_7.metric_time__day AS user__metric_time__day + , subq_7.metric_time__week AS user__metric_time__week + , subq_7.metric_time__month AS user__metric_time__month + , subq_7.metric_time__quarter AS user__metric_time__quarter + , subq_7.metric_time__year AS user__metric_time__year + , subq_7.metric_time__extract_year AS user__metric_time__extract_year + , subq_7.metric_time__extract_quarter AS user__metric_time__extract_quarter + , subq_7.metric_time__extract_month AS user__metric_time__extract_month + , subq_7.metric_time__extract_day AS user__metric_time__extract_day + , subq_7.metric_time__extract_dow AS user__metric_time__extract_dow + , subq_7.metric_time__extract_doy AS user__metric_time__extract_doy + , subq_4.listing AS listing + , subq_4.user AS user + , subq_4.listing__user AS listing__user + , subq_4.country_latest AS country_latest + , subq_4.is_lux_latest AS is_lux_latest + , subq_4.capacity_latest AS capacity_latest + , subq_4.listing__country_latest AS listing__country_latest + , subq_4.listing__is_lux_latest AS listing__is_lux_latest + , subq_4.listing__capacity_latest AS listing__capacity_latest + , subq_7.home_state AS user__home_state + , subq_4.listings AS listings + , subq_4.largest_listing AS largest_listing + , subq_4.smallest_listing AS smallest_listing + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_3.ds__day + , subq_3.ds__week + , subq_3.ds__month + , subq_3.ds__quarter + , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_day + , subq_3.ds__extract_dow + , subq_3.ds__extract_doy + , subq_3.created_at__day + , subq_3.created_at__week + , subq_3.created_at__month + , subq_3.created_at__quarter + , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy + , subq_3.listing__ds__day + , subq_3.listing__ds__week + , subq_3.listing__ds__month + , subq_3.listing__ds__quarter + , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dow + , subq_3.listing__ds__extract_doy + , subq_3.listing__created_at__day + , subq_3.listing__created_at__week + , subq_3.listing__created_at__month + , subq_3.listing__created_at__quarter + , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dow + , subq_3.listing__created_at__extract_doy + , subq_3.ds__day AS metric_time__day + , subq_3.ds__week AS metric_time__week + , subq_3.ds__month AS metric_time__month + , subq_3.ds__quarter AS metric_time__quarter + , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy + , subq_3.listing + , subq_3.user + , subq_3.listing__user + , subq_3.country_latest + , subq_3.is_lux_latest + , subq_3.capacity_latest + , subq_3.listing__country_latest + , subq_3.listing__is_lux_latest + , subq_3.listing__capacity_latest + , subq_3.listings + , subq_3.largest_listing + , subq_3.smallest_listing + FROM ( + -- Read Elements From Semantic Model 'listings_latest' + SELECT + 1 AS listings + , listings_latest_src_28000.capacity AS largest_listing + , listings_latest_src_28000.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS created_at__extract_dow + , EXTRACT(doy 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 + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy 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 + FROM ***************************.dim_listings_latest listings_latest_src_28000 + ) subq_3 + ) subq_4 + LEFT OUTER JOIN ( + -- Pass Only Elements: [ + -- 'home_state', + -- 'user__home_state', + -- 'ds__day', + -- 'ds__week', + -- 'ds__month', + -- 'ds__quarter', + -- 'ds__year', + -- 'ds__extract_year', + -- 'ds__extract_quarter', + -- 'ds__extract_month', + -- 'ds__extract_day', + -- 'ds__extract_dow', + -- 'ds__extract_doy', + -- 'created_at__day', + -- 'created_at__week', + -- 'created_at__month', + -- 'created_at__quarter', + -- 'created_at__year', + -- 'created_at__extract_year', + -- 'created_at__extract_quarter', + -- 'created_at__extract_month', + -- 'created_at__extract_day', + -- 'created_at__extract_dow', + -- 'created_at__extract_doy', + -- 'ds_partitioned__day', + -- 'ds_partitioned__week', + -- 'ds_partitioned__month', + -- 'ds_partitioned__quarter', + -- 'ds_partitioned__year', + -- 'ds_partitioned__extract_year', + -- 'ds_partitioned__extract_quarter', + -- 'ds_partitioned__extract_month', + -- 'ds_partitioned__extract_day', + -- 'ds_partitioned__extract_dow', + -- 'ds_partitioned__extract_doy', + -- 'last_profile_edit_ts__millisecond', + -- 'last_profile_edit_ts__second', + -- 'last_profile_edit_ts__minute', + -- 'last_profile_edit_ts__hour', + -- 'last_profile_edit_ts__day', + -- 'last_profile_edit_ts__week', + -- 'last_profile_edit_ts__month', + -- 'last_profile_edit_ts__quarter', + -- 'last_profile_edit_ts__year', + -- 'last_profile_edit_ts__extract_year', + -- 'last_profile_edit_ts__extract_quarter', + -- 'last_profile_edit_ts__extract_month', + -- 'last_profile_edit_ts__extract_day', + -- 'last_profile_edit_ts__extract_dow', + -- 'last_profile_edit_ts__extract_doy', + -- 'bio_added_ts__second', + -- 'bio_added_ts__minute', + -- 'bio_added_ts__hour', + -- 'bio_added_ts__day', + -- 'bio_added_ts__week', + -- 'bio_added_ts__month', + -- 'bio_added_ts__quarter', + -- 'bio_added_ts__year', + -- 'bio_added_ts__extract_year', + -- 'bio_added_ts__extract_quarter', + -- 'bio_added_ts__extract_month', + -- 'bio_added_ts__extract_day', + -- 'bio_added_ts__extract_dow', + -- 'bio_added_ts__extract_doy', + -- 'last_login_ts__minute', + -- 'last_login_ts__hour', + -- 'last_login_ts__day', + -- 'last_login_ts__week', + -- 'last_login_ts__month', + -- 'last_login_ts__quarter', + -- 'last_login_ts__year', + -- 'last_login_ts__extract_year', + -- 'last_login_ts__extract_quarter', + -- 'last_login_ts__extract_month', + -- 'last_login_ts__extract_day', + -- 'last_login_ts__extract_dow', + -- 'last_login_ts__extract_doy', + -- 'archived_at__hour', + -- 'archived_at__day', + -- 'archived_at__week', + -- 'archived_at__month', + -- 'archived_at__quarter', + -- 'archived_at__year', + -- 'archived_at__extract_year', + -- 'archived_at__extract_quarter', + -- 'archived_at__extract_month', + -- 'archived_at__extract_day', + -- 'archived_at__extract_dow', + -- 'archived_at__extract_doy', + -- 'user__ds__day', + -- 'user__ds__week', + -- 'user__ds__month', + -- 'user__ds__quarter', + -- 'user__ds__year', + -- 'user__ds__extract_year', + -- 'user__ds__extract_quarter', + -- 'user__ds__extract_month', + -- 'user__ds__extract_day', + -- 'user__ds__extract_dow', + -- 'user__ds__extract_doy', + -- 'user__created_at__day', + -- 'user__created_at__week', + -- 'user__created_at__month', + -- 'user__created_at__quarter', + -- 'user__created_at__year', + -- 'user__created_at__extract_year', + -- 'user__created_at__extract_quarter', + -- 'user__created_at__extract_month', + -- 'user__created_at__extract_day', + -- 'user__created_at__extract_dow', + -- 'user__created_at__extract_doy', + -- 'user__ds_partitioned__day', + -- 'user__ds_partitioned__week', + -- 'user__ds_partitioned__month', + -- 'user__ds_partitioned__quarter', + -- 'user__ds_partitioned__year', + -- 'user__ds_partitioned__extract_year', + -- 'user__ds_partitioned__extract_quarter', + -- 'user__ds_partitioned__extract_month', + -- 'user__ds_partitioned__extract_day', + -- 'user__ds_partitioned__extract_dow', + -- 'user__ds_partitioned__extract_doy', + -- 'user__last_profile_edit_ts__millisecond', + -- 'user__last_profile_edit_ts__second', + -- 'user__last_profile_edit_ts__minute', + -- 'user__last_profile_edit_ts__hour', + -- 'user__last_profile_edit_ts__day', + -- 'user__last_profile_edit_ts__week', + -- 'user__last_profile_edit_ts__month', + -- 'user__last_profile_edit_ts__quarter', + -- 'user__last_profile_edit_ts__year', + -- 'user__last_profile_edit_ts__extract_year', + -- 'user__last_profile_edit_ts__extract_quarter', + -- 'user__last_profile_edit_ts__extract_month', + -- 'user__last_profile_edit_ts__extract_day', + -- 'user__last_profile_edit_ts__extract_dow', + -- 'user__last_profile_edit_ts__extract_doy', + -- 'user__bio_added_ts__second', + -- 'user__bio_added_ts__minute', + -- 'user__bio_added_ts__hour', + -- 'user__bio_added_ts__day', + -- 'user__bio_added_ts__week', + -- 'user__bio_added_ts__month', + -- 'user__bio_added_ts__quarter', + -- 'user__bio_added_ts__year', + -- 'user__bio_added_ts__extract_year', + -- 'user__bio_added_ts__extract_quarter', + -- 'user__bio_added_ts__extract_month', + -- 'user__bio_added_ts__extract_day', + -- 'user__bio_added_ts__extract_dow', + -- 'user__bio_added_ts__extract_doy', + -- 'user__last_login_ts__minute', + -- 'user__last_login_ts__hour', + -- 'user__last_login_ts__day', + -- 'user__last_login_ts__week', + -- 'user__last_login_ts__month', + -- 'user__last_login_ts__quarter', + -- 'user__last_login_ts__year', + -- 'user__last_login_ts__extract_year', + -- 'user__last_login_ts__extract_quarter', + -- 'user__last_login_ts__extract_month', + -- 'user__last_login_ts__extract_day', + -- 'user__last_login_ts__extract_dow', + -- 'user__last_login_ts__extract_doy', + -- 'user__archived_at__hour', + -- 'user__archived_at__day', + -- 'user__archived_at__week', + -- 'user__archived_at__month', + -- 'user__archived_at__quarter', + -- 'user__archived_at__year', + -- 'user__archived_at__extract_year', + -- 'user__archived_at__extract_quarter', + -- 'user__archived_at__extract_month', + -- 'user__archived_at__extract_day', + -- 'user__archived_at__extract_dow', + -- 'user__archived_at__extract_doy', + -- 'metric_time__day', + -- 'metric_time__week', + -- 'metric_time__month', + -- 'metric_time__quarter', + -- 'metric_time__year', + -- 'metric_time__extract_year', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_month', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'user', + -- ] + SELECT + subq_6.ds__day + , subq_6.ds__week + , subq_6.ds__month + , subq_6.ds__quarter + , subq_6.ds__year + , subq_6.ds__extract_year + , subq_6.ds__extract_quarter + , subq_6.ds__extract_month + , subq_6.ds__extract_day + , subq_6.ds__extract_dow + , subq_6.ds__extract_doy + , subq_6.created_at__day + , subq_6.created_at__week + , subq_6.created_at__month + , subq_6.created_at__quarter + , subq_6.created_at__year + , subq_6.created_at__extract_year + , subq_6.created_at__extract_quarter + , subq_6.created_at__extract_month + , subq_6.created_at__extract_day + , subq_6.created_at__extract_dow + , subq_6.created_at__extract_doy + , subq_6.ds_partitioned__day + , subq_6.ds_partitioned__week + , subq_6.ds_partitioned__month + , subq_6.ds_partitioned__quarter + , subq_6.ds_partitioned__year + , subq_6.ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy + , subq_6.last_profile_edit_ts__millisecond + , subq_6.last_profile_edit_ts__second + , subq_6.last_profile_edit_ts__minute + , subq_6.last_profile_edit_ts__hour + , subq_6.last_profile_edit_ts__day + , subq_6.last_profile_edit_ts__week + , subq_6.last_profile_edit_ts__month + , subq_6.last_profile_edit_ts__quarter + , subq_6.last_profile_edit_ts__year + , subq_6.last_profile_edit_ts__extract_year + , subq_6.last_profile_edit_ts__extract_quarter + , subq_6.last_profile_edit_ts__extract_month + , subq_6.last_profile_edit_ts__extract_day + , subq_6.last_profile_edit_ts__extract_dow + , subq_6.last_profile_edit_ts__extract_doy + , subq_6.bio_added_ts__second + , subq_6.bio_added_ts__minute + , subq_6.bio_added_ts__hour + , subq_6.bio_added_ts__day + , subq_6.bio_added_ts__week + , subq_6.bio_added_ts__month + , subq_6.bio_added_ts__quarter + , subq_6.bio_added_ts__year + , subq_6.bio_added_ts__extract_year + , subq_6.bio_added_ts__extract_quarter + , subq_6.bio_added_ts__extract_month + , subq_6.bio_added_ts__extract_day + , subq_6.bio_added_ts__extract_dow + , subq_6.bio_added_ts__extract_doy + , subq_6.last_login_ts__minute + , subq_6.last_login_ts__hour + , subq_6.last_login_ts__day + , subq_6.last_login_ts__week + , subq_6.last_login_ts__month + , subq_6.last_login_ts__quarter + , subq_6.last_login_ts__year + , subq_6.last_login_ts__extract_year + , subq_6.last_login_ts__extract_quarter + , subq_6.last_login_ts__extract_month + , subq_6.last_login_ts__extract_day + , subq_6.last_login_ts__extract_dow + , subq_6.last_login_ts__extract_doy + , subq_6.archived_at__hour + , subq_6.archived_at__day + , subq_6.archived_at__week + , subq_6.archived_at__month + , subq_6.archived_at__quarter + , subq_6.archived_at__year + , subq_6.archived_at__extract_year + , subq_6.archived_at__extract_quarter + , subq_6.archived_at__extract_month + , subq_6.archived_at__extract_day + , subq_6.archived_at__extract_dow + , subq_6.archived_at__extract_doy + , subq_6.user__ds__day + , subq_6.user__ds__week + , subq_6.user__ds__month + , subq_6.user__ds__quarter + , subq_6.user__ds__year + , subq_6.user__ds__extract_year + , subq_6.user__ds__extract_quarter + , subq_6.user__ds__extract_month + , subq_6.user__ds__extract_day + , subq_6.user__ds__extract_dow + , subq_6.user__ds__extract_doy + , subq_6.user__created_at__day + , subq_6.user__created_at__week + , subq_6.user__created_at__month + , subq_6.user__created_at__quarter + , subq_6.user__created_at__year + , subq_6.user__created_at__extract_year + , subq_6.user__created_at__extract_quarter + , subq_6.user__created_at__extract_month + , subq_6.user__created_at__extract_day + , subq_6.user__created_at__extract_dow + , subq_6.user__created_at__extract_doy + , subq_6.user__ds_partitioned__day + , subq_6.user__ds_partitioned__week + , subq_6.user__ds_partitioned__month + , subq_6.user__ds_partitioned__quarter + , subq_6.user__ds_partitioned__year + , subq_6.user__ds_partitioned__extract_year + , subq_6.user__ds_partitioned__extract_quarter + , subq_6.user__ds_partitioned__extract_month + , subq_6.user__ds_partitioned__extract_day + , subq_6.user__ds_partitioned__extract_dow + , subq_6.user__ds_partitioned__extract_doy + , subq_6.user__last_profile_edit_ts__millisecond + , subq_6.user__last_profile_edit_ts__second + , subq_6.user__last_profile_edit_ts__minute + , subq_6.user__last_profile_edit_ts__hour + , subq_6.user__last_profile_edit_ts__day + , subq_6.user__last_profile_edit_ts__week + , subq_6.user__last_profile_edit_ts__month + , subq_6.user__last_profile_edit_ts__quarter + , subq_6.user__last_profile_edit_ts__year + , subq_6.user__last_profile_edit_ts__extract_year + , subq_6.user__last_profile_edit_ts__extract_quarter + , subq_6.user__last_profile_edit_ts__extract_month + , subq_6.user__last_profile_edit_ts__extract_day + , subq_6.user__last_profile_edit_ts__extract_dow + , subq_6.user__last_profile_edit_ts__extract_doy + , subq_6.user__bio_added_ts__second + , subq_6.user__bio_added_ts__minute + , subq_6.user__bio_added_ts__hour + , subq_6.user__bio_added_ts__day + , subq_6.user__bio_added_ts__week + , subq_6.user__bio_added_ts__month + , subq_6.user__bio_added_ts__quarter + , subq_6.user__bio_added_ts__year + , subq_6.user__bio_added_ts__extract_year + , subq_6.user__bio_added_ts__extract_quarter + , subq_6.user__bio_added_ts__extract_month + , subq_6.user__bio_added_ts__extract_day + , subq_6.user__bio_added_ts__extract_dow + , subq_6.user__bio_added_ts__extract_doy + , subq_6.user__last_login_ts__minute + , subq_6.user__last_login_ts__hour + , subq_6.user__last_login_ts__day + , subq_6.user__last_login_ts__week + , subq_6.user__last_login_ts__month + , subq_6.user__last_login_ts__quarter + , subq_6.user__last_login_ts__year + , subq_6.user__last_login_ts__extract_year + , subq_6.user__last_login_ts__extract_quarter + , subq_6.user__last_login_ts__extract_month + , subq_6.user__last_login_ts__extract_day + , subq_6.user__last_login_ts__extract_dow + , subq_6.user__last_login_ts__extract_doy + , subq_6.user__archived_at__hour + , subq_6.user__archived_at__day + , subq_6.user__archived_at__week + , subq_6.user__archived_at__month + , subq_6.user__archived_at__quarter + , subq_6.user__archived_at__year + , subq_6.user__archived_at__extract_year + , subq_6.user__archived_at__extract_quarter + , subq_6.user__archived_at__extract_month + , subq_6.user__archived_at__extract_day + , subq_6.user__archived_at__extract_dow + , subq_6.user__archived_at__extract_doy + , subq_6.metric_time__day + , subq_6.metric_time__week + , subq_6.metric_time__month + , subq_6.metric_time__quarter + , subq_6.metric_time__year + , subq_6.metric_time__extract_year + , subq_6.metric_time__extract_quarter + , subq_6.metric_time__extract_month + , subq_6.metric_time__extract_day + , subq_6.metric_time__extract_dow + , subq_6.metric_time__extract_doy + , subq_6.user + , subq_6.home_state + , subq_6.user__home_state + FROM ( + -- Metric Time Dimension 'created_at' + SELECT + subq_5.ds__day + , subq_5.ds__week + , subq_5.ds__month + , subq_5.ds__quarter + , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_day + , subq_5.ds__extract_dow + , subq_5.ds__extract_doy + , subq_5.created_at__day + , subq_5.created_at__week + , subq_5.created_at__month + , subq_5.created_at__quarter + , subq_5.created_at__year + , subq_5.created_at__extract_year + , subq_5.created_at__extract_quarter + , subq_5.created_at__extract_month + , subq_5.created_at__extract_day + , subq_5.created_at__extract_dow + , subq_5.created_at__extract_doy + , subq_5.ds_partitioned__day + , subq_5.ds_partitioned__week + , subq_5.ds_partitioned__month + , subq_5.ds_partitioned__quarter + , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dow + , subq_5.ds_partitioned__extract_doy + , subq_5.last_profile_edit_ts__millisecond + , subq_5.last_profile_edit_ts__second + , subq_5.last_profile_edit_ts__minute + , subq_5.last_profile_edit_ts__hour + , subq_5.last_profile_edit_ts__day + , subq_5.last_profile_edit_ts__week + , subq_5.last_profile_edit_ts__month + , subq_5.last_profile_edit_ts__quarter + , subq_5.last_profile_edit_ts__year + , subq_5.last_profile_edit_ts__extract_year + , subq_5.last_profile_edit_ts__extract_quarter + , subq_5.last_profile_edit_ts__extract_month + , subq_5.last_profile_edit_ts__extract_day + , subq_5.last_profile_edit_ts__extract_dow + , subq_5.last_profile_edit_ts__extract_doy + , subq_5.bio_added_ts__second + , subq_5.bio_added_ts__minute + , subq_5.bio_added_ts__hour + , subq_5.bio_added_ts__day + , subq_5.bio_added_ts__week + , subq_5.bio_added_ts__month + , subq_5.bio_added_ts__quarter + , subq_5.bio_added_ts__year + , subq_5.bio_added_ts__extract_year + , subq_5.bio_added_ts__extract_quarter + , subq_5.bio_added_ts__extract_month + , subq_5.bio_added_ts__extract_day + , subq_5.bio_added_ts__extract_dow + , subq_5.bio_added_ts__extract_doy + , subq_5.last_login_ts__minute + , subq_5.last_login_ts__hour + , subq_5.last_login_ts__day + , subq_5.last_login_ts__week + , subq_5.last_login_ts__month + , subq_5.last_login_ts__quarter + , subq_5.last_login_ts__year + , subq_5.last_login_ts__extract_year + , subq_5.last_login_ts__extract_quarter + , subq_5.last_login_ts__extract_month + , subq_5.last_login_ts__extract_day + , subq_5.last_login_ts__extract_dow + , subq_5.last_login_ts__extract_doy + , subq_5.archived_at__hour + , subq_5.archived_at__day + , subq_5.archived_at__week + , subq_5.archived_at__month + , subq_5.archived_at__quarter + , subq_5.archived_at__year + , subq_5.archived_at__extract_year + , subq_5.archived_at__extract_quarter + , subq_5.archived_at__extract_month + , subq_5.archived_at__extract_day + , subq_5.archived_at__extract_dow + , subq_5.archived_at__extract_doy + , subq_5.user__ds__day + , subq_5.user__ds__week + , subq_5.user__ds__month + , subq_5.user__ds__quarter + , subq_5.user__ds__year + , subq_5.user__ds__extract_year + , subq_5.user__ds__extract_quarter + , subq_5.user__ds__extract_month + , subq_5.user__ds__extract_day + , subq_5.user__ds__extract_dow + , subq_5.user__ds__extract_doy + , subq_5.user__created_at__day + , subq_5.user__created_at__week + , subq_5.user__created_at__month + , subq_5.user__created_at__quarter + , subq_5.user__created_at__year + , subq_5.user__created_at__extract_year + , subq_5.user__created_at__extract_quarter + , subq_5.user__created_at__extract_month + , subq_5.user__created_at__extract_day + , subq_5.user__created_at__extract_dow + , subq_5.user__created_at__extract_doy + , subq_5.user__ds_partitioned__day + , subq_5.user__ds_partitioned__week + , subq_5.user__ds_partitioned__month + , subq_5.user__ds_partitioned__quarter + , subq_5.user__ds_partitioned__year + , subq_5.user__ds_partitioned__extract_year + , subq_5.user__ds_partitioned__extract_quarter + , subq_5.user__ds_partitioned__extract_month + , subq_5.user__ds_partitioned__extract_day + , subq_5.user__ds_partitioned__extract_dow + , subq_5.user__ds_partitioned__extract_doy + , subq_5.user__last_profile_edit_ts__millisecond + , subq_5.user__last_profile_edit_ts__second + , subq_5.user__last_profile_edit_ts__minute + , subq_5.user__last_profile_edit_ts__hour + , subq_5.user__last_profile_edit_ts__day + , subq_5.user__last_profile_edit_ts__week + , subq_5.user__last_profile_edit_ts__month + , subq_5.user__last_profile_edit_ts__quarter + , subq_5.user__last_profile_edit_ts__year + , subq_5.user__last_profile_edit_ts__extract_year + , subq_5.user__last_profile_edit_ts__extract_quarter + , subq_5.user__last_profile_edit_ts__extract_month + , subq_5.user__last_profile_edit_ts__extract_day + , subq_5.user__last_profile_edit_ts__extract_dow + , subq_5.user__last_profile_edit_ts__extract_doy + , subq_5.user__bio_added_ts__second + , subq_5.user__bio_added_ts__minute + , subq_5.user__bio_added_ts__hour + , subq_5.user__bio_added_ts__day + , subq_5.user__bio_added_ts__week + , subq_5.user__bio_added_ts__month + , subq_5.user__bio_added_ts__quarter + , subq_5.user__bio_added_ts__year + , subq_5.user__bio_added_ts__extract_year + , subq_5.user__bio_added_ts__extract_quarter + , subq_5.user__bio_added_ts__extract_month + , subq_5.user__bio_added_ts__extract_day + , subq_5.user__bio_added_ts__extract_dow + , subq_5.user__bio_added_ts__extract_doy + , subq_5.user__last_login_ts__minute + , subq_5.user__last_login_ts__hour + , subq_5.user__last_login_ts__day + , subq_5.user__last_login_ts__week + , subq_5.user__last_login_ts__month + , subq_5.user__last_login_ts__quarter + , subq_5.user__last_login_ts__year + , subq_5.user__last_login_ts__extract_year + , subq_5.user__last_login_ts__extract_quarter + , subq_5.user__last_login_ts__extract_month + , subq_5.user__last_login_ts__extract_day + , subq_5.user__last_login_ts__extract_dow + , subq_5.user__last_login_ts__extract_doy + , subq_5.user__archived_at__hour + , subq_5.user__archived_at__day + , subq_5.user__archived_at__week + , subq_5.user__archived_at__month + , subq_5.user__archived_at__quarter + , subq_5.user__archived_at__year + , subq_5.user__archived_at__extract_year + , subq_5.user__archived_at__extract_quarter + , subq_5.user__archived_at__extract_month + , subq_5.user__archived_at__extract_day + , subq_5.user__archived_at__extract_dow + , subq_5.user__archived_at__extract_doy + , subq_5.created_at__day AS metric_time__day + , subq_5.created_at__week AS metric_time__week + , subq_5.created_at__month AS metric_time__month + , subq_5.created_at__quarter AS metric_time__quarter + , subq_5.created_at__year AS metric_time__year + , subq_5.created_at__extract_year AS metric_time__extract_year + , subq_5.created_at__extract_quarter AS metric_time__extract_quarter + , subq_5.created_at__extract_month AS metric_time__extract_month + , subq_5.created_at__extract_day AS metric_time__extract_day + , subq_5.created_at__extract_dow AS metric_time__extract_dow + , subq_5.created_at__extract_doy AS metric_time__extract_doy + , subq_5.user + , subq_5.home_state + , subq_5.user__home_state + , subq_5.new_users + FROM ( + -- Read Elements From Semantic Model 'users_ds_source' + SELECT + 1 AS new_users + , 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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_5 + ) subq_6 + ) subq_7 + ON + subq_4.user = subq_7.user + ) subq_8 + ) subq_9 + ON + ( + subq_2.listing = subq_9.listing + ) AND ( + subq_2.ds_partitioned__day = subq_9.user__ds_partitioned__day + ) + ) subq_10 + ) subq_11 + GROUP BY + subq_11.listing__user__bio_added_ts__minute +) subq_12 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql new file mode 100644 index 0000000000..d93a3918ba --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql @@ -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 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_metric_with_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_metric_with_sub_daily_dimension__plan0.sql new file mode 100644 index 0000000000..182f443356 --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_metric_with_sub_daily_dimension__plan0.sql @@ -0,0 +1,394 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.user__archived_at__hour + , subq_3.new_users +FROM ( + -- Aggregate Measures + SELECT + subq_2.user__archived_at__hour + , SUM(subq_2.new_users) AS new_users + FROM ( + -- Pass Only Elements: ['new_users', 'user__archived_at__hour'] + SELECT + subq_1.user__archived_at__hour + , subq_1.new_users + FROM ( + -- Metric Time Dimension 'created_at' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.created_at__day + , subq_0.created_at__week + , subq_0.created_at__month + , subq_0.created_at__quarter + , subq_0.created_at__year + , subq_0.created_at__extract_year + , subq_0.created_at__extract_quarter + , subq_0.created_at__extract_month + , subq_0.created_at__extract_day + , subq_0.created_at__extract_dow + , subq_0.created_at__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.last_profile_edit_ts__millisecond + , subq_0.last_profile_edit_ts__second + , subq_0.last_profile_edit_ts__minute + , subq_0.last_profile_edit_ts__hour + , subq_0.last_profile_edit_ts__day + , subq_0.last_profile_edit_ts__week + , subq_0.last_profile_edit_ts__month + , subq_0.last_profile_edit_ts__quarter + , subq_0.last_profile_edit_ts__year + , subq_0.last_profile_edit_ts__extract_year + , subq_0.last_profile_edit_ts__extract_quarter + , subq_0.last_profile_edit_ts__extract_month + , subq_0.last_profile_edit_ts__extract_day + , subq_0.last_profile_edit_ts__extract_dow + , subq_0.last_profile_edit_ts__extract_doy + , subq_0.bio_added_ts__second + , subq_0.bio_added_ts__minute + , subq_0.bio_added_ts__hour + , subq_0.bio_added_ts__day + , subq_0.bio_added_ts__week + , subq_0.bio_added_ts__month + , subq_0.bio_added_ts__quarter + , subq_0.bio_added_ts__year + , subq_0.bio_added_ts__extract_year + , subq_0.bio_added_ts__extract_quarter + , subq_0.bio_added_ts__extract_month + , subq_0.bio_added_ts__extract_day + , subq_0.bio_added_ts__extract_dow + , subq_0.bio_added_ts__extract_doy + , subq_0.last_login_ts__minute + , subq_0.last_login_ts__hour + , subq_0.last_login_ts__day + , subq_0.last_login_ts__week + , subq_0.last_login_ts__month + , subq_0.last_login_ts__quarter + , subq_0.last_login_ts__year + , subq_0.last_login_ts__extract_year + , subq_0.last_login_ts__extract_quarter + , subq_0.last_login_ts__extract_month + , subq_0.last_login_ts__extract_day + , subq_0.last_login_ts__extract_dow + , subq_0.last_login_ts__extract_doy + , subq_0.archived_at__hour + , subq_0.archived_at__day + , subq_0.archived_at__week + , subq_0.archived_at__month + , subq_0.archived_at__quarter + , subq_0.archived_at__year + , subq_0.archived_at__extract_year + , subq_0.archived_at__extract_quarter + , subq_0.archived_at__extract_month + , subq_0.archived_at__extract_day + , subq_0.archived_at__extract_dow + , subq_0.archived_at__extract_doy + , subq_0.user__ds__day + , subq_0.user__ds__week + , subq_0.user__ds__month + , subq_0.user__ds__quarter + , subq_0.user__ds__year + , subq_0.user__ds__extract_year + , subq_0.user__ds__extract_quarter + , subq_0.user__ds__extract_month + , subq_0.user__ds__extract_day + , subq_0.user__ds__extract_dow + , subq_0.user__ds__extract_doy + , subq_0.user__created_at__day + , subq_0.user__created_at__week + , subq_0.user__created_at__month + , subq_0.user__created_at__quarter + , subq_0.user__created_at__year + , subq_0.user__created_at__extract_year + , subq_0.user__created_at__extract_quarter + , subq_0.user__created_at__extract_month + , subq_0.user__created_at__extract_day + , subq_0.user__created_at__extract_dow + , subq_0.user__created_at__extract_doy + , subq_0.user__ds_partitioned__day + , subq_0.user__ds_partitioned__week + , subq_0.user__ds_partitioned__month + , subq_0.user__ds_partitioned__quarter + , subq_0.user__ds_partitioned__year + , subq_0.user__ds_partitioned__extract_year + , subq_0.user__ds_partitioned__extract_quarter + , subq_0.user__ds_partitioned__extract_month + , subq_0.user__ds_partitioned__extract_day + , subq_0.user__ds_partitioned__extract_dow + , subq_0.user__ds_partitioned__extract_doy + , subq_0.user__last_profile_edit_ts__millisecond + , subq_0.user__last_profile_edit_ts__second + , subq_0.user__last_profile_edit_ts__minute + , subq_0.user__last_profile_edit_ts__hour + , subq_0.user__last_profile_edit_ts__day + , subq_0.user__last_profile_edit_ts__week + , subq_0.user__last_profile_edit_ts__month + , subq_0.user__last_profile_edit_ts__quarter + , subq_0.user__last_profile_edit_ts__year + , subq_0.user__last_profile_edit_ts__extract_year + , subq_0.user__last_profile_edit_ts__extract_quarter + , subq_0.user__last_profile_edit_ts__extract_month + , subq_0.user__last_profile_edit_ts__extract_day + , subq_0.user__last_profile_edit_ts__extract_dow + , subq_0.user__last_profile_edit_ts__extract_doy + , subq_0.user__bio_added_ts__second + , subq_0.user__bio_added_ts__minute + , subq_0.user__bio_added_ts__hour + , subq_0.user__bio_added_ts__day + , subq_0.user__bio_added_ts__week + , subq_0.user__bio_added_ts__month + , subq_0.user__bio_added_ts__quarter + , subq_0.user__bio_added_ts__year + , subq_0.user__bio_added_ts__extract_year + , subq_0.user__bio_added_ts__extract_quarter + , subq_0.user__bio_added_ts__extract_month + , subq_0.user__bio_added_ts__extract_day + , subq_0.user__bio_added_ts__extract_dow + , subq_0.user__bio_added_ts__extract_doy + , subq_0.user__last_login_ts__minute + , subq_0.user__last_login_ts__hour + , subq_0.user__last_login_ts__day + , subq_0.user__last_login_ts__week + , subq_0.user__last_login_ts__month + , subq_0.user__last_login_ts__quarter + , subq_0.user__last_login_ts__year + , subq_0.user__last_login_ts__extract_year + , subq_0.user__last_login_ts__extract_quarter + , subq_0.user__last_login_ts__extract_month + , subq_0.user__last_login_ts__extract_day + , subq_0.user__last_login_ts__extract_dow + , subq_0.user__last_login_ts__extract_doy + , subq_0.user__archived_at__hour + , subq_0.user__archived_at__day + , subq_0.user__archived_at__week + , subq_0.user__archived_at__month + , subq_0.user__archived_at__quarter + , subq_0.user__archived_at__year + , subq_0.user__archived_at__extract_year + , subq_0.user__archived_at__extract_quarter + , subq_0.user__archived_at__extract_month + , subq_0.user__archived_at__extract_day + , subq_0.user__archived_at__extract_dow + , subq_0.user__archived_at__extract_doy + , subq_0.created_at__day AS metric_time__day + , subq_0.created_at__week AS metric_time__week + , subq_0.created_at__month AS metric_time__month + , subq_0.created_at__quarter AS metric_time__quarter + , subq_0.created_at__year AS metric_time__year + , subq_0.created_at__extract_year AS metric_time__extract_year + , subq_0.created_at__extract_quarter AS metric_time__extract_quarter + , subq_0.created_at__extract_month AS metric_time__extract_month + , subq_0.created_at__extract_day AS metric_time__extract_day + , subq_0.created_at__extract_dow AS metric_time__extract_dow + , subq_0.created_at__extract_doy AS metric_time__extract_doy + , subq_0.user + , subq_0.home_state + , subq_0.user__home_state + , subq_0.new_users + FROM ( + -- Read Elements From Semantic Model 'users_ds_source' + SELECT + 1 AS new_users + , 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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(DAYOFWEEK_ISO 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 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.user__archived_at__hour +) subq_3 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql new file mode 100644 index 0000000000..c20146c881 --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql @@ -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 + DATE_TRUNC('hour', archived_at) 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 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql new file mode 100644 index 0000000000..2319c7e1f9 --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql @@ -0,0 +1,1303 @@ +-- Compute Metrics via Expressions +SELECT + subq_12.listing__user__bio_added_ts__minute + , subq_12.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_11.listing__user__bio_added_ts__minute + , SUM(subq_11.bookings) AS bookings + FROM ( + -- Pass Only Elements: ['bookings', 'listing__user__bio_added_ts__minute'] + SELECT + subq_10.listing__user__bio_added_ts__minute + , subq_10.bookings + FROM ( + -- Join Standard Outputs + SELECT + subq_2.ds_partitioned__day AS ds_partitioned__day + , subq_9.user__ds_partitioned__day AS listing__user__ds_partitioned__day + , subq_9.user__bio_added_ts__minute AS listing__user__bio_added_ts__minute + , subq_2.listing AS listing + , subq_2.bookings AS bookings + FROM ( + -- Pass Only Elements: ['bookings', 'ds_partitioned__day', 'listing'] + SELECT + subq_1.ds_partitioned__day + , subq_1.listing + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_28000.booking_value + , bookings_source_src_28000.booking_value AS max_booking_value + , bookings_source_src_28000.booking_value AS min_booking_value + , bookings_source_src_28000.guest_id AS bookers + , bookings_source_src_28000.booking_value AS average_booking_value + , bookings_source_src_28000.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_28000.booking_value AS median_booking_value + , bookings_source_src_28000.booking_value AS booking_value_p99 + , bookings_source_src_28000.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28000.is_instant + , DATE_TRUNC('day', bookings_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy + , bookings_source_src_28000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28000.listing_id AS listing + , bookings_source_src_28000.guest_id AS guest + , bookings_source_src_28000.host_id AS host + , bookings_source_src_28000.listing_id AS booking__listing + , bookings_source_src_28000.guest_id AS booking__guest + , bookings_source_src_28000.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28000 + ) subq_0 + ) subq_1 + ) subq_2 + LEFT OUTER JOIN ( + -- Pass Only Elements: ['user__ds_partitioned__day', 'user__bio_added_ts__minute', 'listing'] + SELECT + subq_8.user__ds_partitioned__day + , subq_8.user__bio_added_ts__minute + , subq_8.listing + FROM ( + -- Join Standard Outputs + SELECT + subq_4.ds__day AS ds__day + , subq_4.ds__week AS ds__week + , subq_4.ds__month AS ds__month + , subq_4.ds__quarter AS ds__quarter + , subq_4.ds__year AS ds__year + , subq_4.ds__extract_year AS ds__extract_year + , subq_4.ds__extract_quarter AS ds__extract_quarter + , subq_4.ds__extract_month AS ds__extract_month + , subq_4.ds__extract_day AS ds__extract_day + , subq_4.ds__extract_dow AS ds__extract_dow + , subq_4.ds__extract_doy AS ds__extract_doy + , subq_4.created_at__day AS created_at__day + , subq_4.created_at__week AS created_at__week + , subq_4.created_at__month AS created_at__month + , subq_4.created_at__quarter AS created_at__quarter + , subq_4.created_at__year AS created_at__year + , subq_4.created_at__extract_year AS created_at__extract_year + , subq_4.created_at__extract_quarter AS created_at__extract_quarter + , subq_4.created_at__extract_month AS created_at__extract_month + , subq_4.created_at__extract_day AS created_at__extract_day + , subq_4.created_at__extract_dow AS created_at__extract_dow + , subq_4.created_at__extract_doy AS created_at__extract_doy + , subq_4.listing__ds__day AS listing__ds__day + , subq_4.listing__ds__week AS listing__ds__week + , subq_4.listing__ds__month AS listing__ds__month + , subq_4.listing__ds__quarter AS listing__ds__quarter + , subq_4.listing__ds__year AS listing__ds__year + , subq_4.listing__ds__extract_year AS listing__ds__extract_year + , subq_4.listing__ds__extract_quarter AS listing__ds__extract_quarter + , subq_4.listing__ds__extract_month AS listing__ds__extract_month + , subq_4.listing__ds__extract_day AS listing__ds__extract_day + , subq_4.listing__ds__extract_dow AS listing__ds__extract_dow + , subq_4.listing__ds__extract_doy AS listing__ds__extract_doy + , subq_4.listing__created_at__day AS listing__created_at__day + , subq_4.listing__created_at__week AS listing__created_at__week + , subq_4.listing__created_at__month AS listing__created_at__month + , subq_4.listing__created_at__quarter AS listing__created_at__quarter + , subq_4.listing__created_at__year AS listing__created_at__year + , subq_4.listing__created_at__extract_year AS listing__created_at__extract_year + , subq_4.listing__created_at__extract_quarter AS listing__created_at__extract_quarter + , subq_4.listing__created_at__extract_month AS listing__created_at__extract_month + , subq_4.listing__created_at__extract_day AS listing__created_at__extract_day + , subq_4.listing__created_at__extract_dow AS listing__created_at__extract_dow + , subq_4.listing__created_at__extract_doy AS listing__created_at__extract_doy + , subq_4.metric_time__day AS metric_time__day + , 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_7.ds__day AS user__ds__day + , subq_7.ds__week AS user__ds__week + , subq_7.ds__month AS user__ds__month + , subq_7.ds__quarter AS user__ds__quarter + , subq_7.ds__year AS user__ds__year + , subq_7.ds__extract_year AS user__ds__extract_year + , subq_7.ds__extract_quarter AS user__ds__extract_quarter + , subq_7.ds__extract_month AS user__ds__extract_month + , subq_7.ds__extract_day AS user__ds__extract_day + , subq_7.ds__extract_dow AS user__ds__extract_dow + , subq_7.ds__extract_doy AS user__ds__extract_doy + , subq_7.created_at__day AS user__created_at__day + , subq_7.created_at__week AS user__created_at__week + , subq_7.created_at__month AS user__created_at__month + , subq_7.created_at__quarter AS user__created_at__quarter + , subq_7.created_at__year AS user__created_at__year + , subq_7.created_at__extract_year AS user__created_at__extract_year + , subq_7.created_at__extract_quarter AS user__created_at__extract_quarter + , subq_7.created_at__extract_month AS user__created_at__extract_month + , subq_7.created_at__extract_day AS user__created_at__extract_day + , subq_7.created_at__extract_dow AS user__created_at__extract_dow + , subq_7.created_at__extract_doy AS user__created_at__extract_doy + , subq_7.ds_partitioned__day AS user__ds_partitioned__day + , subq_7.ds_partitioned__week AS user__ds_partitioned__week + , subq_7.ds_partitioned__month AS user__ds_partitioned__month + , subq_7.ds_partitioned__quarter AS user__ds_partitioned__quarter + , subq_7.ds_partitioned__year AS user__ds_partitioned__year + , subq_7.ds_partitioned__extract_year AS user__ds_partitioned__extract_year + , subq_7.ds_partitioned__extract_quarter AS user__ds_partitioned__extract_quarter + , subq_7.ds_partitioned__extract_month AS user__ds_partitioned__extract_month + , subq_7.ds_partitioned__extract_day AS user__ds_partitioned__extract_day + , subq_7.ds_partitioned__extract_dow AS user__ds_partitioned__extract_dow + , subq_7.ds_partitioned__extract_doy AS user__ds_partitioned__extract_doy + , subq_7.last_profile_edit_ts__millisecond AS user__last_profile_edit_ts__millisecond + , subq_7.last_profile_edit_ts__second AS user__last_profile_edit_ts__second + , subq_7.last_profile_edit_ts__minute AS user__last_profile_edit_ts__minute + , subq_7.last_profile_edit_ts__hour AS user__last_profile_edit_ts__hour + , subq_7.last_profile_edit_ts__day AS user__last_profile_edit_ts__day + , subq_7.last_profile_edit_ts__week AS user__last_profile_edit_ts__week + , subq_7.last_profile_edit_ts__month AS user__last_profile_edit_ts__month + , subq_7.last_profile_edit_ts__quarter AS user__last_profile_edit_ts__quarter + , subq_7.last_profile_edit_ts__year AS user__last_profile_edit_ts__year + , subq_7.last_profile_edit_ts__extract_year AS user__last_profile_edit_ts__extract_year + , subq_7.last_profile_edit_ts__extract_quarter AS user__last_profile_edit_ts__extract_quarter + , subq_7.last_profile_edit_ts__extract_month AS user__last_profile_edit_ts__extract_month + , subq_7.last_profile_edit_ts__extract_day AS user__last_profile_edit_ts__extract_day + , subq_7.last_profile_edit_ts__extract_dow AS user__last_profile_edit_ts__extract_dow + , subq_7.last_profile_edit_ts__extract_doy AS user__last_profile_edit_ts__extract_doy + , subq_7.bio_added_ts__second AS user__bio_added_ts__second + , subq_7.bio_added_ts__minute AS user__bio_added_ts__minute + , subq_7.bio_added_ts__hour AS user__bio_added_ts__hour + , subq_7.bio_added_ts__day AS user__bio_added_ts__day + , subq_7.bio_added_ts__week AS user__bio_added_ts__week + , subq_7.bio_added_ts__month AS user__bio_added_ts__month + , subq_7.bio_added_ts__quarter AS user__bio_added_ts__quarter + , subq_7.bio_added_ts__year AS user__bio_added_ts__year + , subq_7.bio_added_ts__extract_year AS user__bio_added_ts__extract_year + , subq_7.bio_added_ts__extract_quarter AS user__bio_added_ts__extract_quarter + , subq_7.bio_added_ts__extract_month AS user__bio_added_ts__extract_month + , subq_7.bio_added_ts__extract_day AS user__bio_added_ts__extract_day + , subq_7.bio_added_ts__extract_dow AS user__bio_added_ts__extract_dow + , subq_7.bio_added_ts__extract_doy AS user__bio_added_ts__extract_doy + , subq_7.last_login_ts__minute AS user__last_login_ts__minute + , subq_7.last_login_ts__hour AS user__last_login_ts__hour + , subq_7.last_login_ts__day AS user__last_login_ts__day + , subq_7.last_login_ts__week AS user__last_login_ts__week + , subq_7.last_login_ts__month AS user__last_login_ts__month + , subq_7.last_login_ts__quarter AS user__last_login_ts__quarter + , subq_7.last_login_ts__year AS user__last_login_ts__year + , subq_7.last_login_ts__extract_year AS user__last_login_ts__extract_year + , subq_7.last_login_ts__extract_quarter AS user__last_login_ts__extract_quarter + , subq_7.last_login_ts__extract_month AS user__last_login_ts__extract_month + , subq_7.last_login_ts__extract_day AS user__last_login_ts__extract_day + , subq_7.last_login_ts__extract_dow AS user__last_login_ts__extract_dow + , subq_7.last_login_ts__extract_doy AS user__last_login_ts__extract_doy + , subq_7.archived_at__hour AS user__archived_at__hour + , subq_7.archived_at__day AS user__archived_at__day + , subq_7.archived_at__week AS user__archived_at__week + , subq_7.archived_at__month AS user__archived_at__month + , subq_7.archived_at__quarter AS user__archived_at__quarter + , subq_7.archived_at__year AS user__archived_at__year + , subq_7.archived_at__extract_year AS user__archived_at__extract_year + , subq_7.archived_at__extract_quarter AS user__archived_at__extract_quarter + , subq_7.archived_at__extract_month AS user__archived_at__extract_month + , subq_7.archived_at__extract_day AS user__archived_at__extract_day + , subq_7.archived_at__extract_dow AS user__archived_at__extract_dow + , subq_7.archived_at__extract_doy AS user__archived_at__extract_doy + , subq_7.metric_time__day AS user__metric_time__day + , subq_7.metric_time__week AS user__metric_time__week + , subq_7.metric_time__month AS user__metric_time__month + , subq_7.metric_time__quarter AS user__metric_time__quarter + , subq_7.metric_time__year AS user__metric_time__year + , subq_7.metric_time__extract_year AS user__metric_time__extract_year + , subq_7.metric_time__extract_quarter AS user__metric_time__extract_quarter + , subq_7.metric_time__extract_month AS user__metric_time__extract_month + , subq_7.metric_time__extract_day AS user__metric_time__extract_day + , subq_7.metric_time__extract_dow AS user__metric_time__extract_dow + , subq_7.metric_time__extract_doy AS user__metric_time__extract_doy + , subq_4.listing AS listing + , subq_4.user AS user + , subq_4.listing__user AS listing__user + , subq_4.country_latest AS country_latest + , subq_4.is_lux_latest AS is_lux_latest + , subq_4.capacity_latest AS capacity_latest + , subq_4.listing__country_latest AS listing__country_latest + , subq_4.listing__is_lux_latest AS listing__is_lux_latest + , subq_4.listing__capacity_latest AS listing__capacity_latest + , subq_7.home_state AS user__home_state + , subq_4.listings AS listings + , subq_4.largest_listing AS largest_listing + , subq_4.smallest_listing AS smallest_listing + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_3.ds__day + , subq_3.ds__week + , subq_3.ds__month + , subq_3.ds__quarter + , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_day + , subq_3.ds__extract_dow + , subq_3.ds__extract_doy + , subq_3.created_at__day + , subq_3.created_at__week + , subq_3.created_at__month + , subq_3.created_at__quarter + , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy + , subq_3.listing__ds__day + , subq_3.listing__ds__week + , subq_3.listing__ds__month + , subq_3.listing__ds__quarter + , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dow + , subq_3.listing__ds__extract_doy + , subq_3.listing__created_at__day + , subq_3.listing__created_at__week + , subq_3.listing__created_at__month + , subq_3.listing__created_at__quarter + , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dow + , subq_3.listing__created_at__extract_doy + , subq_3.ds__day AS metric_time__day + , subq_3.ds__week AS metric_time__week + , subq_3.ds__month AS metric_time__month + , subq_3.ds__quarter AS metric_time__quarter + , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy + , subq_3.listing + , subq_3.user + , subq_3.listing__user + , subq_3.country_latest + , subq_3.is_lux_latest + , subq_3.capacity_latest + , subq_3.listing__country_latest + , subq_3.listing__is_lux_latest + , subq_3.listing__capacity_latest + , subq_3.listings + , subq_3.largest_listing + , subq_3.smallest_listing + FROM ( + -- Read Elements From Semantic Model 'listings_latest' + SELECT + 1 AS listings + , listings_latest_src_28000.capacity AS largest_listing + , listings_latest_src_28000.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow + , EXTRACT(doy 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 + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy 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 + FROM ***************************.dim_listings_latest listings_latest_src_28000 + ) subq_3 + ) subq_4 + LEFT OUTER JOIN ( + -- Pass Only Elements: [ + -- 'home_state', + -- 'user__home_state', + -- 'ds__day', + -- 'ds__week', + -- 'ds__month', + -- 'ds__quarter', + -- 'ds__year', + -- 'ds__extract_year', + -- 'ds__extract_quarter', + -- 'ds__extract_month', + -- 'ds__extract_day', + -- 'ds__extract_dow', + -- 'ds__extract_doy', + -- 'created_at__day', + -- 'created_at__week', + -- 'created_at__month', + -- 'created_at__quarter', + -- 'created_at__year', + -- 'created_at__extract_year', + -- 'created_at__extract_quarter', + -- 'created_at__extract_month', + -- 'created_at__extract_day', + -- 'created_at__extract_dow', + -- 'created_at__extract_doy', + -- 'ds_partitioned__day', + -- 'ds_partitioned__week', + -- 'ds_partitioned__month', + -- 'ds_partitioned__quarter', + -- 'ds_partitioned__year', + -- 'ds_partitioned__extract_year', + -- 'ds_partitioned__extract_quarter', + -- 'ds_partitioned__extract_month', + -- 'ds_partitioned__extract_day', + -- 'ds_partitioned__extract_dow', + -- 'ds_partitioned__extract_doy', + -- 'last_profile_edit_ts__millisecond', + -- 'last_profile_edit_ts__second', + -- 'last_profile_edit_ts__minute', + -- 'last_profile_edit_ts__hour', + -- 'last_profile_edit_ts__day', + -- 'last_profile_edit_ts__week', + -- 'last_profile_edit_ts__month', + -- 'last_profile_edit_ts__quarter', + -- 'last_profile_edit_ts__year', + -- 'last_profile_edit_ts__extract_year', + -- 'last_profile_edit_ts__extract_quarter', + -- 'last_profile_edit_ts__extract_month', + -- 'last_profile_edit_ts__extract_day', + -- 'last_profile_edit_ts__extract_dow', + -- 'last_profile_edit_ts__extract_doy', + -- 'bio_added_ts__second', + -- 'bio_added_ts__minute', + -- 'bio_added_ts__hour', + -- 'bio_added_ts__day', + -- 'bio_added_ts__week', + -- 'bio_added_ts__month', + -- 'bio_added_ts__quarter', + -- 'bio_added_ts__year', + -- 'bio_added_ts__extract_year', + -- 'bio_added_ts__extract_quarter', + -- 'bio_added_ts__extract_month', + -- 'bio_added_ts__extract_day', + -- 'bio_added_ts__extract_dow', + -- 'bio_added_ts__extract_doy', + -- 'last_login_ts__minute', + -- 'last_login_ts__hour', + -- 'last_login_ts__day', + -- 'last_login_ts__week', + -- 'last_login_ts__month', + -- 'last_login_ts__quarter', + -- 'last_login_ts__year', + -- 'last_login_ts__extract_year', + -- 'last_login_ts__extract_quarter', + -- 'last_login_ts__extract_month', + -- 'last_login_ts__extract_day', + -- 'last_login_ts__extract_dow', + -- 'last_login_ts__extract_doy', + -- 'archived_at__hour', + -- 'archived_at__day', + -- 'archived_at__week', + -- 'archived_at__month', + -- 'archived_at__quarter', + -- 'archived_at__year', + -- 'archived_at__extract_year', + -- 'archived_at__extract_quarter', + -- 'archived_at__extract_month', + -- 'archived_at__extract_day', + -- 'archived_at__extract_dow', + -- 'archived_at__extract_doy', + -- 'user__ds__day', + -- 'user__ds__week', + -- 'user__ds__month', + -- 'user__ds__quarter', + -- 'user__ds__year', + -- 'user__ds__extract_year', + -- 'user__ds__extract_quarter', + -- 'user__ds__extract_month', + -- 'user__ds__extract_day', + -- 'user__ds__extract_dow', + -- 'user__ds__extract_doy', + -- 'user__created_at__day', + -- 'user__created_at__week', + -- 'user__created_at__month', + -- 'user__created_at__quarter', + -- 'user__created_at__year', + -- 'user__created_at__extract_year', + -- 'user__created_at__extract_quarter', + -- 'user__created_at__extract_month', + -- 'user__created_at__extract_day', + -- 'user__created_at__extract_dow', + -- 'user__created_at__extract_doy', + -- 'user__ds_partitioned__day', + -- 'user__ds_partitioned__week', + -- 'user__ds_partitioned__month', + -- 'user__ds_partitioned__quarter', + -- 'user__ds_partitioned__year', + -- 'user__ds_partitioned__extract_year', + -- 'user__ds_partitioned__extract_quarter', + -- 'user__ds_partitioned__extract_month', + -- 'user__ds_partitioned__extract_day', + -- 'user__ds_partitioned__extract_dow', + -- 'user__ds_partitioned__extract_doy', + -- 'user__last_profile_edit_ts__millisecond', + -- 'user__last_profile_edit_ts__second', + -- 'user__last_profile_edit_ts__minute', + -- 'user__last_profile_edit_ts__hour', + -- 'user__last_profile_edit_ts__day', + -- 'user__last_profile_edit_ts__week', + -- 'user__last_profile_edit_ts__month', + -- 'user__last_profile_edit_ts__quarter', + -- 'user__last_profile_edit_ts__year', + -- 'user__last_profile_edit_ts__extract_year', + -- 'user__last_profile_edit_ts__extract_quarter', + -- 'user__last_profile_edit_ts__extract_month', + -- 'user__last_profile_edit_ts__extract_day', + -- 'user__last_profile_edit_ts__extract_dow', + -- 'user__last_profile_edit_ts__extract_doy', + -- 'user__bio_added_ts__second', + -- 'user__bio_added_ts__minute', + -- 'user__bio_added_ts__hour', + -- 'user__bio_added_ts__day', + -- 'user__bio_added_ts__week', + -- 'user__bio_added_ts__month', + -- 'user__bio_added_ts__quarter', + -- 'user__bio_added_ts__year', + -- 'user__bio_added_ts__extract_year', + -- 'user__bio_added_ts__extract_quarter', + -- 'user__bio_added_ts__extract_month', + -- 'user__bio_added_ts__extract_day', + -- 'user__bio_added_ts__extract_dow', + -- 'user__bio_added_ts__extract_doy', + -- 'user__last_login_ts__minute', + -- 'user__last_login_ts__hour', + -- 'user__last_login_ts__day', + -- 'user__last_login_ts__week', + -- 'user__last_login_ts__month', + -- 'user__last_login_ts__quarter', + -- 'user__last_login_ts__year', + -- 'user__last_login_ts__extract_year', + -- 'user__last_login_ts__extract_quarter', + -- 'user__last_login_ts__extract_month', + -- 'user__last_login_ts__extract_day', + -- 'user__last_login_ts__extract_dow', + -- 'user__last_login_ts__extract_doy', + -- 'user__archived_at__hour', + -- 'user__archived_at__day', + -- 'user__archived_at__week', + -- 'user__archived_at__month', + -- 'user__archived_at__quarter', + -- 'user__archived_at__year', + -- 'user__archived_at__extract_year', + -- 'user__archived_at__extract_quarter', + -- 'user__archived_at__extract_month', + -- 'user__archived_at__extract_day', + -- 'user__archived_at__extract_dow', + -- 'user__archived_at__extract_doy', + -- 'metric_time__day', + -- 'metric_time__week', + -- 'metric_time__month', + -- 'metric_time__quarter', + -- 'metric_time__year', + -- 'metric_time__extract_year', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_month', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'user', + -- ] + SELECT + subq_6.ds__day + , subq_6.ds__week + , subq_6.ds__month + , subq_6.ds__quarter + , subq_6.ds__year + , subq_6.ds__extract_year + , subq_6.ds__extract_quarter + , subq_6.ds__extract_month + , subq_6.ds__extract_day + , subq_6.ds__extract_dow + , subq_6.ds__extract_doy + , subq_6.created_at__day + , subq_6.created_at__week + , subq_6.created_at__month + , subq_6.created_at__quarter + , subq_6.created_at__year + , subq_6.created_at__extract_year + , subq_6.created_at__extract_quarter + , subq_6.created_at__extract_month + , subq_6.created_at__extract_day + , subq_6.created_at__extract_dow + , subq_6.created_at__extract_doy + , subq_6.ds_partitioned__day + , subq_6.ds_partitioned__week + , subq_6.ds_partitioned__month + , subq_6.ds_partitioned__quarter + , subq_6.ds_partitioned__year + , subq_6.ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy + , subq_6.last_profile_edit_ts__millisecond + , subq_6.last_profile_edit_ts__second + , subq_6.last_profile_edit_ts__minute + , subq_6.last_profile_edit_ts__hour + , subq_6.last_profile_edit_ts__day + , subq_6.last_profile_edit_ts__week + , subq_6.last_profile_edit_ts__month + , subq_6.last_profile_edit_ts__quarter + , subq_6.last_profile_edit_ts__year + , subq_6.last_profile_edit_ts__extract_year + , subq_6.last_profile_edit_ts__extract_quarter + , subq_6.last_profile_edit_ts__extract_month + , subq_6.last_profile_edit_ts__extract_day + , subq_6.last_profile_edit_ts__extract_dow + , subq_6.last_profile_edit_ts__extract_doy + , subq_6.bio_added_ts__second + , subq_6.bio_added_ts__minute + , subq_6.bio_added_ts__hour + , subq_6.bio_added_ts__day + , subq_6.bio_added_ts__week + , subq_6.bio_added_ts__month + , subq_6.bio_added_ts__quarter + , subq_6.bio_added_ts__year + , subq_6.bio_added_ts__extract_year + , subq_6.bio_added_ts__extract_quarter + , subq_6.bio_added_ts__extract_month + , subq_6.bio_added_ts__extract_day + , subq_6.bio_added_ts__extract_dow + , subq_6.bio_added_ts__extract_doy + , subq_6.last_login_ts__minute + , subq_6.last_login_ts__hour + , subq_6.last_login_ts__day + , subq_6.last_login_ts__week + , subq_6.last_login_ts__month + , subq_6.last_login_ts__quarter + , subq_6.last_login_ts__year + , subq_6.last_login_ts__extract_year + , subq_6.last_login_ts__extract_quarter + , subq_6.last_login_ts__extract_month + , subq_6.last_login_ts__extract_day + , subq_6.last_login_ts__extract_dow + , subq_6.last_login_ts__extract_doy + , subq_6.archived_at__hour + , subq_6.archived_at__day + , subq_6.archived_at__week + , subq_6.archived_at__month + , subq_6.archived_at__quarter + , subq_6.archived_at__year + , subq_6.archived_at__extract_year + , subq_6.archived_at__extract_quarter + , subq_6.archived_at__extract_month + , subq_6.archived_at__extract_day + , subq_6.archived_at__extract_dow + , subq_6.archived_at__extract_doy + , subq_6.user__ds__day + , subq_6.user__ds__week + , subq_6.user__ds__month + , subq_6.user__ds__quarter + , subq_6.user__ds__year + , subq_6.user__ds__extract_year + , subq_6.user__ds__extract_quarter + , subq_6.user__ds__extract_month + , subq_6.user__ds__extract_day + , subq_6.user__ds__extract_dow + , subq_6.user__ds__extract_doy + , subq_6.user__created_at__day + , subq_6.user__created_at__week + , subq_6.user__created_at__month + , subq_6.user__created_at__quarter + , subq_6.user__created_at__year + , subq_6.user__created_at__extract_year + , subq_6.user__created_at__extract_quarter + , subq_6.user__created_at__extract_month + , subq_6.user__created_at__extract_day + , subq_6.user__created_at__extract_dow + , subq_6.user__created_at__extract_doy + , subq_6.user__ds_partitioned__day + , subq_6.user__ds_partitioned__week + , subq_6.user__ds_partitioned__month + , subq_6.user__ds_partitioned__quarter + , subq_6.user__ds_partitioned__year + , subq_6.user__ds_partitioned__extract_year + , subq_6.user__ds_partitioned__extract_quarter + , subq_6.user__ds_partitioned__extract_month + , subq_6.user__ds_partitioned__extract_day + , subq_6.user__ds_partitioned__extract_dow + , subq_6.user__ds_partitioned__extract_doy + , subq_6.user__last_profile_edit_ts__millisecond + , subq_6.user__last_profile_edit_ts__second + , subq_6.user__last_profile_edit_ts__minute + , subq_6.user__last_profile_edit_ts__hour + , subq_6.user__last_profile_edit_ts__day + , subq_6.user__last_profile_edit_ts__week + , subq_6.user__last_profile_edit_ts__month + , subq_6.user__last_profile_edit_ts__quarter + , subq_6.user__last_profile_edit_ts__year + , subq_6.user__last_profile_edit_ts__extract_year + , subq_6.user__last_profile_edit_ts__extract_quarter + , subq_6.user__last_profile_edit_ts__extract_month + , subq_6.user__last_profile_edit_ts__extract_day + , subq_6.user__last_profile_edit_ts__extract_dow + , subq_6.user__last_profile_edit_ts__extract_doy + , subq_6.user__bio_added_ts__second + , subq_6.user__bio_added_ts__minute + , subq_6.user__bio_added_ts__hour + , subq_6.user__bio_added_ts__day + , subq_6.user__bio_added_ts__week + , subq_6.user__bio_added_ts__month + , subq_6.user__bio_added_ts__quarter + , subq_6.user__bio_added_ts__year + , subq_6.user__bio_added_ts__extract_year + , subq_6.user__bio_added_ts__extract_quarter + , subq_6.user__bio_added_ts__extract_month + , subq_6.user__bio_added_ts__extract_day + , subq_6.user__bio_added_ts__extract_dow + , subq_6.user__bio_added_ts__extract_doy + , subq_6.user__last_login_ts__minute + , subq_6.user__last_login_ts__hour + , subq_6.user__last_login_ts__day + , subq_6.user__last_login_ts__week + , subq_6.user__last_login_ts__month + , subq_6.user__last_login_ts__quarter + , subq_6.user__last_login_ts__year + , subq_6.user__last_login_ts__extract_year + , subq_6.user__last_login_ts__extract_quarter + , subq_6.user__last_login_ts__extract_month + , subq_6.user__last_login_ts__extract_day + , subq_6.user__last_login_ts__extract_dow + , subq_6.user__last_login_ts__extract_doy + , subq_6.user__archived_at__hour + , subq_6.user__archived_at__day + , subq_6.user__archived_at__week + , subq_6.user__archived_at__month + , subq_6.user__archived_at__quarter + , subq_6.user__archived_at__year + , subq_6.user__archived_at__extract_year + , subq_6.user__archived_at__extract_quarter + , subq_6.user__archived_at__extract_month + , subq_6.user__archived_at__extract_day + , subq_6.user__archived_at__extract_dow + , subq_6.user__archived_at__extract_doy + , subq_6.metric_time__day + , subq_6.metric_time__week + , subq_6.metric_time__month + , subq_6.metric_time__quarter + , subq_6.metric_time__year + , subq_6.metric_time__extract_year + , subq_6.metric_time__extract_quarter + , subq_6.metric_time__extract_month + , subq_6.metric_time__extract_day + , subq_6.metric_time__extract_dow + , subq_6.metric_time__extract_doy + , subq_6.user + , subq_6.home_state + , subq_6.user__home_state + FROM ( + -- Metric Time Dimension 'created_at' + SELECT + subq_5.ds__day + , subq_5.ds__week + , subq_5.ds__month + , subq_5.ds__quarter + , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_day + , subq_5.ds__extract_dow + , subq_5.ds__extract_doy + , subq_5.created_at__day + , subq_5.created_at__week + , subq_5.created_at__month + , subq_5.created_at__quarter + , subq_5.created_at__year + , subq_5.created_at__extract_year + , subq_5.created_at__extract_quarter + , subq_5.created_at__extract_month + , subq_5.created_at__extract_day + , subq_5.created_at__extract_dow + , subq_5.created_at__extract_doy + , subq_5.ds_partitioned__day + , subq_5.ds_partitioned__week + , subq_5.ds_partitioned__month + , subq_5.ds_partitioned__quarter + , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dow + , subq_5.ds_partitioned__extract_doy + , subq_5.last_profile_edit_ts__millisecond + , subq_5.last_profile_edit_ts__second + , subq_5.last_profile_edit_ts__minute + , subq_5.last_profile_edit_ts__hour + , subq_5.last_profile_edit_ts__day + , subq_5.last_profile_edit_ts__week + , subq_5.last_profile_edit_ts__month + , subq_5.last_profile_edit_ts__quarter + , subq_5.last_profile_edit_ts__year + , subq_5.last_profile_edit_ts__extract_year + , subq_5.last_profile_edit_ts__extract_quarter + , subq_5.last_profile_edit_ts__extract_month + , subq_5.last_profile_edit_ts__extract_day + , subq_5.last_profile_edit_ts__extract_dow + , subq_5.last_profile_edit_ts__extract_doy + , subq_5.bio_added_ts__second + , subq_5.bio_added_ts__minute + , subq_5.bio_added_ts__hour + , subq_5.bio_added_ts__day + , subq_5.bio_added_ts__week + , subq_5.bio_added_ts__month + , subq_5.bio_added_ts__quarter + , subq_5.bio_added_ts__year + , subq_5.bio_added_ts__extract_year + , subq_5.bio_added_ts__extract_quarter + , subq_5.bio_added_ts__extract_month + , subq_5.bio_added_ts__extract_day + , subq_5.bio_added_ts__extract_dow + , subq_5.bio_added_ts__extract_doy + , subq_5.last_login_ts__minute + , subq_5.last_login_ts__hour + , subq_5.last_login_ts__day + , subq_5.last_login_ts__week + , subq_5.last_login_ts__month + , subq_5.last_login_ts__quarter + , subq_5.last_login_ts__year + , subq_5.last_login_ts__extract_year + , subq_5.last_login_ts__extract_quarter + , subq_5.last_login_ts__extract_month + , subq_5.last_login_ts__extract_day + , subq_5.last_login_ts__extract_dow + , subq_5.last_login_ts__extract_doy + , subq_5.archived_at__hour + , subq_5.archived_at__day + , subq_5.archived_at__week + , subq_5.archived_at__month + , subq_5.archived_at__quarter + , subq_5.archived_at__year + , subq_5.archived_at__extract_year + , subq_5.archived_at__extract_quarter + , subq_5.archived_at__extract_month + , subq_5.archived_at__extract_day + , subq_5.archived_at__extract_dow + , subq_5.archived_at__extract_doy + , subq_5.user__ds__day + , subq_5.user__ds__week + , subq_5.user__ds__month + , subq_5.user__ds__quarter + , subq_5.user__ds__year + , subq_5.user__ds__extract_year + , subq_5.user__ds__extract_quarter + , subq_5.user__ds__extract_month + , subq_5.user__ds__extract_day + , subq_5.user__ds__extract_dow + , subq_5.user__ds__extract_doy + , subq_5.user__created_at__day + , subq_5.user__created_at__week + , subq_5.user__created_at__month + , subq_5.user__created_at__quarter + , subq_5.user__created_at__year + , subq_5.user__created_at__extract_year + , subq_5.user__created_at__extract_quarter + , subq_5.user__created_at__extract_month + , subq_5.user__created_at__extract_day + , subq_5.user__created_at__extract_dow + , subq_5.user__created_at__extract_doy + , subq_5.user__ds_partitioned__day + , subq_5.user__ds_partitioned__week + , subq_5.user__ds_partitioned__month + , subq_5.user__ds_partitioned__quarter + , subq_5.user__ds_partitioned__year + , subq_5.user__ds_partitioned__extract_year + , subq_5.user__ds_partitioned__extract_quarter + , subq_5.user__ds_partitioned__extract_month + , subq_5.user__ds_partitioned__extract_day + , subq_5.user__ds_partitioned__extract_dow + , subq_5.user__ds_partitioned__extract_doy + , subq_5.user__last_profile_edit_ts__millisecond + , subq_5.user__last_profile_edit_ts__second + , subq_5.user__last_profile_edit_ts__minute + , subq_5.user__last_profile_edit_ts__hour + , subq_5.user__last_profile_edit_ts__day + , subq_5.user__last_profile_edit_ts__week + , subq_5.user__last_profile_edit_ts__month + , subq_5.user__last_profile_edit_ts__quarter + , subq_5.user__last_profile_edit_ts__year + , subq_5.user__last_profile_edit_ts__extract_year + , subq_5.user__last_profile_edit_ts__extract_quarter + , subq_5.user__last_profile_edit_ts__extract_month + , subq_5.user__last_profile_edit_ts__extract_day + , subq_5.user__last_profile_edit_ts__extract_dow + , subq_5.user__last_profile_edit_ts__extract_doy + , subq_5.user__bio_added_ts__second + , subq_5.user__bio_added_ts__minute + , subq_5.user__bio_added_ts__hour + , subq_5.user__bio_added_ts__day + , subq_5.user__bio_added_ts__week + , subq_5.user__bio_added_ts__month + , subq_5.user__bio_added_ts__quarter + , subq_5.user__bio_added_ts__year + , subq_5.user__bio_added_ts__extract_year + , subq_5.user__bio_added_ts__extract_quarter + , subq_5.user__bio_added_ts__extract_month + , subq_5.user__bio_added_ts__extract_day + , subq_5.user__bio_added_ts__extract_dow + , subq_5.user__bio_added_ts__extract_doy + , subq_5.user__last_login_ts__minute + , subq_5.user__last_login_ts__hour + , subq_5.user__last_login_ts__day + , subq_5.user__last_login_ts__week + , subq_5.user__last_login_ts__month + , subq_5.user__last_login_ts__quarter + , subq_5.user__last_login_ts__year + , subq_5.user__last_login_ts__extract_year + , subq_5.user__last_login_ts__extract_quarter + , subq_5.user__last_login_ts__extract_month + , subq_5.user__last_login_ts__extract_day + , subq_5.user__last_login_ts__extract_dow + , subq_5.user__last_login_ts__extract_doy + , subq_5.user__archived_at__hour + , subq_5.user__archived_at__day + , subq_5.user__archived_at__week + , subq_5.user__archived_at__month + , subq_5.user__archived_at__quarter + , subq_5.user__archived_at__year + , subq_5.user__archived_at__extract_year + , subq_5.user__archived_at__extract_quarter + , subq_5.user__archived_at__extract_month + , subq_5.user__archived_at__extract_day + , subq_5.user__archived_at__extract_dow + , subq_5.user__archived_at__extract_doy + , subq_5.created_at__day AS metric_time__day + , subq_5.created_at__week AS metric_time__week + , subq_5.created_at__month AS metric_time__month + , subq_5.created_at__quarter AS metric_time__quarter + , subq_5.created_at__year AS metric_time__year + , subq_5.created_at__extract_year AS metric_time__extract_year + , subq_5.created_at__extract_quarter AS metric_time__extract_quarter + , subq_5.created_at__extract_month AS metric_time__extract_month + , subq_5.created_at__extract_day AS metric_time__extract_day + , subq_5.created_at__extract_dow AS metric_time__extract_dow + , subq_5.created_at__extract_doy AS metric_time__extract_doy + , subq_5.user + , subq_5.home_state + , subq_5.user__home_state + , subq_5.new_users + FROM ( + -- Read Elements From Semantic Model 'users_ds_source' + SELECT + 1 AS new_users + , 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_5 + ) subq_6 + ) subq_7 + ON + subq_4.user = subq_7.user + ) subq_8 + ) subq_9 + ON + ( + subq_2.listing = subq_9.listing + ) AND ( + subq_2.ds_partitioned__day = subq_9.user__ds_partitioned__day + ) + ) subq_10 + ) subq_11 + GROUP BY + subq_11.listing__user__bio_added_ts__minute +) subq_12 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql new file mode 100644 index 0000000000..d93a3918ba --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql @@ -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 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_metric_with_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_metric_with_sub_daily_dimension__plan0.sql new file mode 100644 index 0000000000..712a3c0a08 --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_metric_with_sub_daily_dimension__plan0.sql @@ -0,0 +1,394 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.user__archived_at__hour + , subq_3.new_users +FROM ( + -- Aggregate Measures + SELECT + subq_2.user__archived_at__hour + , SUM(subq_2.new_users) AS new_users + FROM ( + -- Pass Only Elements: ['new_users', 'user__archived_at__hour'] + SELECT + subq_1.user__archived_at__hour + , subq_1.new_users + FROM ( + -- Metric Time Dimension 'created_at' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.created_at__day + , subq_0.created_at__week + , subq_0.created_at__month + , subq_0.created_at__quarter + , subq_0.created_at__year + , subq_0.created_at__extract_year + , subq_0.created_at__extract_quarter + , subq_0.created_at__extract_month + , subq_0.created_at__extract_day + , subq_0.created_at__extract_dow + , subq_0.created_at__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.last_profile_edit_ts__millisecond + , subq_0.last_profile_edit_ts__second + , subq_0.last_profile_edit_ts__minute + , subq_0.last_profile_edit_ts__hour + , subq_0.last_profile_edit_ts__day + , subq_0.last_profile_edit_ts__week + , subq_0.last_profile_edit_ts__month + , subq_0.last_profile_edit_ts__quarter + , subq_0.last_profile_edit_ts__year + , subq_0.last_profile_edit_ts__extract_year + , subq_0.last_profile_edit_ts__extract_quarter + , subq_0.last_profile_edit_ts__extract_month + , subq_0.last_profile_edit_ts__extract_day + , subq_0.last_profile_edit_ts__extract_dow + , subq_0.last_profile_edit_ts__extract_doy + , subq_0.bio_added_ts__second + , subq_0.bio_added_ts__minute + , subq_0.bio_added_ts__hour + , subq_0.bio_added_ts__day + , subq_0.bio_added_ts__week + , subq_0.bio_added_ts__month + , subq_0.bio_added_ts__quarter + , subq_0.bio_added_ts__year + , subq_0.bio_added_ts__extract_year + , subq_0.bio_added_ts__extract_quarter + , subq_0.bio_added_ts__extract_month + , subq_0.bio_added_ts__extract_day + , subq_0.bio_added_ts__extract_dow + , subq_0.bio_added_ts__extract_doy + , subq_0.last_login_ts__minute + , subq_0.last_login_ts__hour + , subq_0.last_login_ts__day + , subq_0.last_login_ts__week + , subq_0.last_login_ts__month + , subq_0.last_login_ts__quarter + , subq_0.last_login_ts__year + , subq_0.last_login_ts__extract_year + , subq_0.last_login_ts__extract_quarter + , subq_0.last_login_ts__extract_month + , subq_0.last_login_ts__extract_day + , subq_0.last_login_ts__extract_dow + , subq_0.last_login_ts__extract_doy + , subq_0.archived_at__hour + , subq_0.archived_at__day + , subq_0.archived_at__week + , subq_0.archived_at__month + , subq_0.archived_at__quarter + , subq_0.archived_at__year + , subq_0.archived_at__extract_year + , subq_0.archived_at__extract_quarter + , subq_0.archived_at__extract_month + , subq_0.archived_at__extract_day + , subq_0.archived_at__extract_dow + , subq_0.archived_at__extract_doy + , subq_0.user__ds__day + , subq_0.user__ds__week + , subq_0.user__ds__month + , subq_0.user__ds__quarter + , subq_0.user__ds__year + , subq_0.user__ds__extract_year + , subq_0.user__ds__extract_quarter + , subq_0.user__ds__extract_month + , subq_0.user__ds__extract_day + , subq_0.user__ds__extract_dow + , subq_0.user__ds__extract_doy + , subq_0.user__created_at__day + , subq_0.user__created_at__week + , subq_0.user__created_at__month + , subq_0.user__created_at__quarter + , subq_0.user__created_at__year + , subq_0.user__created_at__extract_year + , subq_0.user__created_at__extract_quarter + , subq_0.user__created_at__extract_month + , subq_0.user__created_at__extract_day + , subq_0.user__created_at__extract_dow + , subq_0.user__created_at__extract_doy + , subq_0.user__ds_partitioned__day + , subq_0.user__ds_partitioned__week + , subq_0.user__ds_partitioned__month + , subq_0.user__ds_partitioned__quarter + , subq_0.user__ds_partitioned__year + , subq_0.user__ds_partitioned__extract_year + , subq_0.user__ds_partitioned__extract_quarter + , subq_0.user__ds_partitioned__extract_month + , subq_0.user__ds_partitioned__extract_day + , subq_0.user__ds_partitioned__extract_dow + , subq_0.user__ds_partitioned__extract_doy + , subq_0.user__last_profile_edit_ts__millisecond + , subq_0.user__last_profile_edit_ts__second + , subq_0.user__last_profile_edit_ts__minute + , subq_0.user__last_profile_edit_ts__hour + , subq_0.user__last_profile_edit_ts__day + , subq_0.user__last_profile_edit_ts__week + , subq_0.user__last_profile_edit_ts__month + , subq_0.user__last_profile_edit_ts__quarter + , subq_0.user__last_profile_edit_ts__year + , subq_0.user__last_profile_edit_ts__extract_year + , subq_0.user__last_profile_edit_ts__extract_quarter + , subq_0.user__last_profile_edit_ts__extract_month + , subq_0.user__last_profile_edit_ts__extract_day + , subq_0.user__last_profile_edit_ts__extract_dow + , subq_0.user__last_profile_edit_ts__extract_doy + , subq_0.user__bio_added_ts__second + , subq_0.user__bio_added_ts__minute + , subq_0.user__bio_added_ts__hour + , subq_0.user__bio_added_ts__day + , subq_0.user__bio_added_ts__week + , subq_0.user__bio_added_ts__month + , subq_0.user__bio_added_ts__quarter + , subq_0.user__bio_added_ts__year + , subq_0.user__bio_added_ts__extract_year + , subq_0.user__bio_added_ts__extract_quarter + , subq_0.user__bio_added_ts__extract_month + , subq_0.user__bio_added_ts__extract_day + , subq_0.user__bio_added_ts__extract_dow + , subq_0.user__bio_added_ts__extract_doy + , subq_0.user__last_login_ts__minute + , subq_0.user__last_login_ts__hour + , subq_0.user__last_login_ts__day + , subq_0.user__last_login_ts__week + , subq_0.user__last_login_ts__month + , subq_0.user__last_login_ts__quarter + , subq_0.user__last_login_ts__year + , subq_0.user__last_login_ts__extract_year + , subq_0.user__last_login_ts__extract_quarter + , subq_0.user__last_login_ts__extract_month + , subq_0.user__last_login_ts__extract_day + , subq_0.user__last_login_ts__extract_dow + , subq_0.user__last_login_ts__extract_doy + , subq_0.user__archived_at__hour + , subq_0.user__archived_at__day + , subq_0.user__archived_at__week + , subq_0.user__archived_at__month + , subq_0.user__archived_at__quarter + , subq_0.user__archived_at__year + , subq_0.user__archived_at__extract_year + , subq_0.user__archived_at__extract_quarter + , subq_0.user__archived_at__extract_month + , subq_0.user__archived_at__extract_day + , subq_0.user__archived_at__extract_dow + , subq_0.user__archived_at__extract_doy + , subq_0.created_at__day AS metric_time__day + , subq_0.created_at__week AS metric_time__week + , subq_0.created_at__month AS metric_time__month + , subq_0.created_at__quarter AS metric_time__quarter + , subq_0.created_at__year AS metric_time__year + , subq_0.created_at__extract_year AS metric_time__extract_year + , subq_0.created_at__extract_quarter AS metric_time__extract_quarter + , subq_0.created_at__extract_month AS metric_time__extract_month + , subq_0.created_at__extract_day AS metric_time__extract_day + , subq_0.created_at__extract_dow AS metric_time__extract_dow + , subq_0.created_at__extract_doy AS metric_time__extract_doy + , subq_0.user + , subq_0.home_state + , subq_0.user__home_state + , subq_0.new_users + FROM ( + -- Read Elements From Semantic Model 'users_ds_source' + SELECT + 1 AS new_users + , 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 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.user__archived_at__hour +) subq_3 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql new file mode 100644 index 0000000000..c20146c881 --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql @@ -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 + DATE_TRUNC('hour', archived_at) 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 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql new file mode 100644 index 0000000000..2319c7e1f9 --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql @@ -0,0 +1,1303 @@ +-- Compute Metrics via Expressions +SELECT + subq_12.listing__user__bio_added_ts__minute + , subq_12.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_11.listing__user__bio_added_ts__minute + , SUM(subq_11.bookings) AS bookings + FROM ( + -- Pass Only Elements: ['bookings', 'listing__user__bio_added_ts__minute'] + SELECT + subq_10.listing__user__bio_added_ts__minute + , subq_10.bookings + FROM ( + -- Join Standard Outputs + SELECT + subq_2.ds_partitioned__day AS ds_partitioned__day + , subq_9.user__ds_partitioned__day AS listing__user__ds_partitioned__day + , subq_9.user__bio_added_ts__minute AS listing__user__bio_added_ts__minute + , subq_2.listing AS listing + , subq_2.bookings AS bookings + FROM ( + -- Pass Only Elements: ['bookings', 'ds_partitioned__day', 'listing'] + SELECT + subq_1.ds_partitioned__day + , subq_1.listing + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_28000.booking_value + , bookings_source_src_28000.booking_value AS max_booking_value + , bookings_source_src_28000.booking_value AS min_booking_value + , bookings_source_src_28000.guest_id AS bookers + , bookings_source_src_28000.booking_value AS average_booking_value + , bookings_source_src_28000.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_28000.booking_value AS median_booking_value + , bookings_source_src_28000.booking_value AS booking_value_p99 + , bookings_source_src_28000.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28000.is_instant + , DATE_TRUNC('day', bookings_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy + , bookings_source_src_28000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day + , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day + , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28000.listing_id AS listing + , bookings_source_src_28000.guest_id AS guest + , bookings_source_src_28000.host_id AS host + , bookings_source_src_28000.listing_id AS booking__listing + , bookings_source_src_28000.guest_id AS booking__guest + , bookings_source_src_28000.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28000 + ) subq_0 + ) subq_1 + ) subq_2 + LEFT OUTER JOIN ( + -- Pass Only Elements: ['user__ds_partitioned__day', 'user__bio_added_ts__minute', 'listing'] + SELECT + subq_8.user__ds_partitioned__day + , subq_8.user__bio_added_ts__minute + , subq_8.listing + FROM ( + -- Join Standard Outputs + SELECT + subq_4.ds__day AS ds__day + , subq_4.ds__week AS ds__week + , subq_4.ds__month AS ds__month + , subq_4.ds__quarter AS ds__quarter + , subq_4.ds__year AS ds__year + , subq_4.ds__extract_year AS ds__extract_year + , subq_4.ds__extract_quarter AS ds__extract_quarter + , subq_4.ds__extract_month AS ds__extract_month + , subq_4.ds__extract_day AS ds__extract_day + , subq_4.ds__extract_dow AS ds__extract_dow + , subq_4.ds__extract_doy AS ds__extract_doy + , subq_4.created_at__day AS created_at__day + , subq_4.created_at__week AS created_at__week + , subq_4.created_at__month AS created_at__month + , subq_4.created_at__quarter AS created_at__quarter + , subq_4.created_at__year AS created_at__year + , subq_4.created_at__extract_year AS created_at__extract_year + , subq_4.created_at__extract_quarter AS created_at__extract_quarter + , subq_4.created_at__extract_month AS created_at__extract_month + , subq_4.created_at__extract_day AS created_at__extract_day + , subq_4.created_at__extract_dow AS created_at__extract_dow + , subq_4.created_at__extract_doy AS created_at__extract_doy + , subq_4.listing__ds__day AS listing__ds__day + , subq_4.listing__ds__week AS listing__ds__week + , subq_4.listing__ds__month AS listing__ds__month + , subq_4.listing__ds__quarter AS listing__ds__quarter + , subq_4.listing__ds__year AS listing__ds__year + , subq_4.listing__ds__extract_year AS listing__ds__extract_year + , subq_4.listing__ds__extract_quarter AS listing__ds__extract_quarter + , subq_4.listing__ds__extract_month AS listing__ds__extract_month + , subq_4.listing__ds__extract_day AS listing__ds__extract_day + , subq_4.listing__ds__extract_dow AS listing__ds__extract_dow + , subq_4.listing__ds__extract_doy AS listing__ds__extract_doy + , subq_4.listing__created_at__day AS listing__created_at__day + , subq_4.listing__created_at__week AS listing__created_at__week + , subq_4.listing__created_at__month AS listing__created_at__month + , subq_4.listing__created_at__quarter AS listing__created_at__quarter + , subq_4.listing__created_at__year AS listing__created_at__year + , subq_4.listing__created_at__extract_year AS listing__created_at__extract_year + , subq_4.listing__created_at__extract_quarter AS listing__created_at__extract_quarter + , subq_4.listing__created_at__extract_month AS listing__created_at__extract_month + , subq_4.listing__created_at__extract_day AS listing__created_at__extract_day + , subq_4.listing__created_at__extract_dow AS listing__created_at__extract_dow + , subq_4.listing__created_at__extract_doy AS listing__created_at__extract_doy + , subq_4.metric_time__day AS metric_time__day + , 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_7.ds__day AS user__ds__day + , subq_7.ds__week AS user__ds__week + , subq_7.ds__month AS user__ds__month + , subq_7.ds__quarter AS user__ds__quarter + , subq_7.ds__year AS user__ds__year + , subq_7.ds__extract_year AS user__ds__extract_year + , subq_7.ds__extract_quarter AS user__ds__extract_quarter + , subq_7.ds__extract_month AS user__ds__extract_month + , subq_7.ds__extract_day AS user__ds__extract_day + , subq_7.ds__extract_dow AS user__ds__extract_dow + , subq_7.ds__extract_doy AS user__ds__extract_doy + , subq_7.created_at__day AS user__created_at__day + , subq_7.created_at__week AS user__created_at__week + , subq_7.created_at__month AS user__created_at__month + , subq_7.created_at__quarter AS user__created_at__quarter + , subq_7.created_at__year AS user__created_at__year + , subq_7.created_at__extract_year AS user__created_at__extract_year + , subq_7.created_at__extract_quarter AS user__created_at__extract_quarter + , subq_7.created_at__extract_month AS user__created_at__extract_month + , subq_7.created_at__extract_day AS user__created_at__extract_day + , subq_7.created_at__extract_dow AS user__created_at__extract_dow + , subq_7.created_at__extract_doy AS user__created_at__extract_doy + , subq_7.ds_partitioned__day AS user__ds_partitioned__day + , subq_7.ds_partitioned__week AS user__ds_partitioned__week + , subq_7.ds_partitioned__month AS user__ds_partitioned__month + , subq_7.ds_partitioned__quarter AS user__ds_partitioned__quarter + , subq_7.ds_partitioned__year AS user__ds_partitioned__year + , subq_7.ds_partitioned__extract_year AS user__ds_partitioned__extract_year + , subq_7.ds_partitioned__extract_quarter AS user__ds_partitioned__extract_quarter + , subq_7.ds_partitioned__extract_month AS user__ds_partitioned__extract_month + , subq_7.ds_partitioned__extract_day AS user__ds_partitioned__extract_day + , subq_7.ds_partitioned__extract_dow AS user__ds_partitioned__extract_dow + , subq_7.ds_partitioned__extract_doy AS user__ds_partitioned__extract_doy + , subq_7.last_profile_edit_ts__millisecond AS user__last_profile_edit_ts__millisecond + , subq_7.last_profile_edit_ts__second AS user__last_profile_edit_ts__second + , subq_7.last_profile_edit_ts__minute AS user__last_profile_edit_ts__minute + , subq_7.last_profile_edit_ts__hour AS user__last_profile_edit_ts__hour + , subq_7.last_profile_edit_ts__day AS user__last_profile_edit_ts__day + , subq_7.last_profile_edit_ts__week AS user__last_profile_edit_ts__week + , subq_7.last_profile_edit_ts__month AS user__last_profile_edit_ts__month + , subq_7.last_profile_edit_ts__quarter AS user__last_profile_edit_ts__quarter + , subq_7.last_profile_edit_ts__year AS user__last_profile_edit_ts__year + , subq_7.last_profile_edit_ts__extract_year AS user__last_profile_edit_ts__extract_year + , subq_7.last_profile_edit_ts__extract_quarter AS user__last_profile_edit_ts__extract_quarter + , subq_7.last_profile_edit_ts__extract_month AS user__last_profile_edit_ts__extract_month + , subq_7.last_profile_edit_ts__extract_day AS user__last_profile_edit_ts__extract_day + , subq_7.last_profile_edit_ts__extract_dow AS user__last_profile_edit_ts__extract_dow + , subq_7.last_profile_edit_ts__extract_doy AS user__last_profile_edit_ts__extract_doy + , subq_7.bio_added_ts__second AS user__bio_added_ts__second + , subq_7.bio_added_ts__minute AS user__bio_added_ts__minute + , subq_7.bio_added_ts__hour AS user__bio_added_ts__hour + , subq_7.bio_added_ts__day AS user__bio_added_ts__day + , subq_7.bio_added_ts__week AS user__bio_added_ts__week + , subq_7.bio_added_ts__month AS user__bio_added_ts__month + , subq_7.bio_added_ts__quarter AS user__bio_added_ts__quarter + , subq_7.bio_added_ts__year AS user__bio_added_ts__year + , subq_7.bio_added_ts__extract_year AS user__bio_added_ts__extract_year + , subq_7.bio_added_ts__extract_quarter AS user__bio_added_ts__extract_quarter + , subq_7.bio_added_ts__extract_month AS user__bio_added_ts__extract_month + , subq_7.bio_added_ts__extract_day AS user__bio_added_ts__extract_day + , subq_7.bio_added_ts__extract_dow AS user__bio_added_ts__extract_dow + , subq_7.bio_added_ts__extract_doy AS user__bio_added_ts__extract_doy + , subq_7.last_login_ts__minute AS user__last_login_ts__minute + , subq_7.last_login_ts__hour AS user__last_login_ts__hour + , subq_7.last_login_ts__day AS user__last_login_ts__day + , subq_7.last_login_ts__week AS user__last_login_ts__week + , subq_7.last_login_ts__month AS user__last_login_ts__month + , subq_7.last_login_ts__quarter AS user__last_login_ts__quarter + , subq_7.last_login_ts__year AS user__last_login_ts__year + , subq_7.last_login_ts__extract_year AS user__last_login_ts__extract_year + , subq_7.last_login_ts__extract_quarter AS user__last_login_ts__extract_quarter + , subq_7.last_login_ts__extract_month AS user__last_login_ts__extract_month + , subq_7.last_login_ts__extract_day AS user__last_login_ts__extract_day + , subq_7.last_login_ts__extract_dow AS user__last_login_ts__extract_dow + , subq_7.last_login_ts__extract_doy AS user__last_login_ts__extract_doy + , subq_7.archived_at__hour AS user__archived_at__hour + , subq_7.archived_at__day AS user__archived_at__day + , subq_7.archived_at__week AS user__archived_at__week + , subq_7.archived_at__month AS user__archived_at__month + , subq_7.archived_at__quarter AS user__archived_at__quarter + , subq_7.archived_at__year AS user__archived_at__year + , subq_7.archived_at__extract_year AS user__archived_at__extract_year + , subq_7.archived_at__extract_quarter AS user__archived_at__extract_quarter + , subq_7.archived_at__extract_month AS user__archived_at__extract_month + , subq_7.archived_at__extract_day AS user__archived_at__extract_day + , subq_7.archived_at__extract_dow AS user__archived_at__extract_dow + , subq_7.archived_at__extract_doy AS user__archived_at__extract_doy + , subq_7.metric_time__day AS user__metric_time__day + , subq_7.metric_time__week AS user__metric_time__week + , subq_7.metric_time__month AS user__metric_time__month + , subq_7.metric_time__quarter AS user__metric_time__quarter + , subq_7.metric_time__year AS user__metric_time__year + , subq_7.metric_time__extract_year AS user__metric_time__extract_year + , subq_7.metric_time__extract_quarter AS user__metric_time__extract_quarter + , subq_7.metric_time__extract_month AS user__metric_time__extract_month + , subq_7.metric_time__extract_day AS user__metric_time__extract_day + , subq_7.metric_time__extract_dow AS user__metric_time__extract_dow + , subq_7.metric_time__extract_doy AS user__metric_time__extract_doy + , subq_4.listing AS listing + , subq_4.user AS user + , subq_4.listing__user AS listing__user + , subq_4.country_latest AS country_latest + , subq_4.is_lux_latest AS is_lux_latest + , subq_4.capacity_latest AS capacity_latest + , subq_4.listing__country_latest AS listing__country_latest + , subq_4.listing__is_lux_latest AS listing__is_lux_latest + , subq_4.listing__capacity_latest AS listing__capacity_latest + , subq_7.home_state AS user__home_state + , subq_4.listings AS listings + , subq_4.largest_listing AS largest_listing + , subq_4.smallest_listing AS smallest_listing + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_3.ds__day + , subq_3.ds__week + , subq_3.ds__month + , subq_3.ds__quarter + , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_day + , subq_3.ds__extract_dow + , subq_3.ds__extract_doy + , subq_3.created_at__day + , subq_3.created_at__week + , subq_3.created_at__month + , subq_3.created_at__quarter + , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy + , subq_3.listing__ds__day + , subq_3.listing__ds__week + , subq_3.listing__ds__month + , subq_3.listing__ds__quarter + , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dow + , subq_3.listing__ds__extract_doy + , subq_3.listing__created_at__day + , subq_3.listing__created_at__week + , subq_3.listing__created_at__month + , subq_3.listing__created_at__quarter + , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dow + , subq_3.listing__created_at__extract_doy + , subq_3.ds__day AS metric_time__day + , subq_3.ds__week AS metric_time__week + , subq_3.ds__month AS metric_time__month + , subq_3.ds__quarter AS metric_time__quarter + , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy + , subq_3.listing + , subq_3.user + , subq_3.listing__user + , subq_3.country_latest + , subq_3.is_lux_latest + , subq_3.capacity_latest + , subq_3.listing__country_latest + , subq_3.listing__is_lux_latest + , subq_3.listing__capacity_latest + , subq_3.listings + , subq_3.largest_listing + , subq_3.smallest_listing + FROM ( + -- Read Elements From Semantic Model 'listings_latest' + SELECT + 1 AS listings + , listings_latest_src_28000.capacity AS largest_listing + , listings_latest_src_28000.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow + , EXTRACT(doy 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 + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy 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 + FROM ***************************.dim_listings_latest listings_latest_src_28000 + ) subq_3 + ) subq_4 + LEFT OUTER JOIN ( + -- Pass Only Elements: [ + -- 'home_state', + -- 'user__home_state', + -- 'ds__day', + -- 'ds__week', + -- 'ds__month', + -- 'ds__quarter', + -- 'ds__year', + -- 'ds__extract_year', + -- 'ds__extract_quarter', + -- 'ds__extract_month', + -- 'ds__extract_day', + -- 'ds__extract_dow', + -- 'ds__extract_doy', + -- 'created_at__day', + -- 'created_at__week', + -- 'created_at__month', + -- 'created_at__quarter', + -- 'created_at__year', + -- 'created_at__extract_year', + -- 'created_at__extract_quarter', + -- 'created_at__extract_month', + -- 'created_at__extract_day', + -- 'created_at__extract_dow', + -- 'created_at__extract_doy', + -- 'ds_partitioned__day', + -- 'ds_partitioned__week', + -- 'ds_partitioned__month', + -- 'ds_partitioned__quarter', + -- 'ds_partitioned__year', + -- 'ds_partitioned__extract_year', + -- 'ds_partitioned__extract_quarter', + -- 'ds_partitioned__extract_month', + -- 'ds_partitioned__extract_day', + -- 'ds_partitioned__extract_dow', + -- 'ds_partitioned__extract_doy', + -- 'last_profile_edit_ts__millisecond', + -- 'last_profile_edit_ts__second', + -- 'last_profile_edit_ts__minute', + -- 'last_profile_edit_ts__hour', + -- 'last_profile_edit_ts__day', + -- 'last_profile_edit_ts__week', + -- 'last_profile_edit_ts__month', + -- 'last_profile_edit_ts__quarter', + -- 'last_profile_edit_ts__year', + -- 'last_profile_edit_ts__extract_year', + -- 'last_profile_edit_ts__extract_quarter', + -- 'last_profile_edit_ts__extract_month', + -- 'last_profile_edit_ts__extract_day', + -- 'last_profile_edit_ts__extract_dow', + -- 'last_profile_edit_ts__extract_doy', + -- 'bio_added_ts__second', + -- 'bio_added_ts__minute', + -- 'bio_added_ts__hour', + -- 'bio_added_ts__day', + -- 'bio_added_ts__week', + -- 'bio_added_ts__month', + -- 'bio_added_ts__quarter', + -- 'bio_added_ts__year', + -- 'bio_added_ts__extract_year', + -- 'bio_added_ts__extract_quarter', + -- 'bio_added_ts__extract_month', + -- 'bio_added_ts__extract_day', + -- 'bio_added_ts__extract_dow', + -- 'bio_added_ts__extract_doy', + -- 'last_login_ts__minute', + -- 'last_login_ts__hour', + -- 'last_login_ts__day', + -- 'last_login_ts__week', + -- 'last_login_ts__month', + -- 'last_login_ts__quarter', + -- 'last_login_ts__year', + -- 'last_login_ts__extract_year', + -- 'last_login_ts__extract_quarter', + -- 'last_login_ts__extract_month', + -- 'last_login_ts__extract_day', + -- 'last_login_ts__extract_dow', + -- 'last_login_ts__extract_doy', + -- 'archived_at__hour', + -- 'archived_at__day', + -- 'archived_at__week', + -- 'archived_at__month', + -- 'archived_at__quarter', + -- 'archived_at__year', + -- 'archived_at__extract_year', + -- 'archived_at__extract_quarter', + -- 'archived_at__extract_month', + -- 'archived_at__extract_day', + -- 'archived_at__extract_dow', + -- 'archived_at__extract_doy', + -- 'user__ds__day', + -- 'user__ds__week', + -- 'user__ds__month', + -- 'user__ds__quarter', + -- 'user__ds__year', + -- 'user__ds__extract_year', + -- 'user__ds__extract_quarter', + -- 'user__ds__extract_month', + -- 'user__ds__extract_day', + -- 'user__ds__extract_dow', + -- 'user__ds__extract_doy', + -- 'user__created_at__day', + -- 'user__created_at__week', + -- 'user__created_at__month', + -- 'user__created_at__quarter', + -- 'user__created_at__year', + -- 'user__created_at__extract_year', + -- 'user__created_at__extract_quarter', + -- 'user__created_at__extract_month', + -- 'user__created_at__extract_day', + -- 'user__created_at__extract_dow', + -- 'user__created_at__extract_doy', + -- 'user__ds_partitioned__day', + -- 'user__ds_partitioned__week', + -- 'user__ds_partitioned__month', + -- 'user__ds_partitioned__quarter', + -- 'user__ds_partitioned__year', + -- 'user__ds_partitioned__extract_year', + -- 'user__ds_partitioned__extract_quarter', + -- 'user__ds_partitioned__extract_month', + -- 'user__ds_partitioned__extract_day', + -- 'user__ds_partitioned__extract_dow', + -- 'user__ds_partitioned__extract_doy', + -- 'user__last_profile_edit_ts__millisecond', + -- 'user__last_profile_edit_ts__second', + -- 'user__last_profile_edit_ts__minute', + -- 'user__last_profile_edit_ts__hour', + -- 'user__last_profile_edit_ts__day', + -- 'user__last_profile_edit_ts__week', + -- 'user__last_profile_edit_ts__month', + -- 'user__last_profile_edit_ts__quarter', + -- 'user__last_profile_edit_ts__year', + -- 'user__last_profile_edit_ts__extract_year', + -- 'user__last_profile_edit_ts__extract_quarter', + -- 'user__last_profile_edit_ts__extract_month', + -- 'user__last_profile_edit_ts__extract_day', + -- 'user__last_profile_edit_ts__extract_dow', + -- 'user__last_profile_edit_ts__extract_doy', + -- 'user__bio_added_ts__second', + -- 'user__bio_added_ts__minute', + -- 'user__bio_added_ts__hour', + -- 'user__bio_added_ts__day', + -- 'user__bio_added_ts__week', + -- 'user__bio_added_ts__month', + -- 'user__bio_added_ts__quarter', + -- 'user__bio_added_ts__year', + -- 'user__bio_added_ts__extract_year', + -- 'user__bio_added_ts__extract_quarter', + -- 'user__bio_added_ts__extract_month', + -- 'user__bio_added_ts__extract_day', + -- 'user__bio_added_ts__extract_dow', + -- 'user__bio_added_ts__extract_doy', + -- 'user__last_login_ts__minute', + -- 'user__last_login_ts__hour', + -- 'user__last_login_ts__day', + -- 'user__last_login_ts__week', + -- 'user__last_login_ts__month', + -- 'user__last_login_ts__quarter', + -- 'user__last_login_ts__year', + -- 'user__last_login_ts__extract_year', + -- 'user__last_login_ts__extract_quarter', + -- 'user__last_login_ts__extract_month', + -- 'user__last_login_ts__extract_day', + -- 'user__last_login_ts__extract_dow', + -- 'user__last_login_ts__extract_doy', + -- 'user__archived_at__hour', + -- 'user__archived_at__day', + -- 'user__archived_at__week', + -- 'user__archived_at__month', + -- 'user__archived_at__quarter', + -- 'user__archived_at__year', + -- 'user__archived_at__extract_year', + -- 'user__archived_at__extract_quarter', + -- 'user__archived_at__extract_month', + -- 'user__archived_at__extract_day', + -- 'user__archived_at__extract_dow', + -- 'user__archived_at__extract_doy', + -- 'metric_time__day', + -- 'metric_time__week', + -- 'metric_time__month', + -- 'metric_time__quarter', + -- 'metric_time__year', + -- 'metric_time__extract_year', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_month', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'user', + -- ] + SELECT + subq_6.ds__day + , subq_6.ds__week + , subq_6.ds__month + , subq_6.ds__quarter + , subq_6.ds__year + , subq_6.ds__extract_year + , subq_6.ds__extract_quarter + , subq_6.ds__extract_month + , subq_6.ds__extract_day + , subq_6.ds__extract_dow + , subq_6.ds__extract_doy + , subq_6.created_at__day + , subq_6.created_at__week + , subq_6.created_at__month + , subq_6.created_at__quarter + , subq_6.created_at__year + , subq_6.created_at__extract_year + , subq_6.created_at__extract_quarter + , subq_6.created_at__extract_month + , subq_6.created_at__extract_day + , subq_6.created_at__extract_dow + , subq_6.created_at__extract_doy + , subq_6.ds_partitioned__day + , subq_6.ds_partitioned__week + , subq_6.ds_partitioned__month + , subq_6.ds_partitioned__quarter + , subq_6.ds_partitioned__year + , subq_6.ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy + , subq_6.last_profile_edit_ts__millisecond + , subq_6.last_profile_edit_ts__second + , subq_6.last_profile_edit_ts__minute + , subq_6.last_profile_edit_ts__hour + , subq_6.last_profile_edit_ts__day + , subq_6.last_profile_edit_ts__week + , subq_6.last_profile_edit_ts__month + , subq_6.last_profile_edit_ts__quarter + , subq_6.last_profile_edit_ts__year + , subq_6.last_profile_edit_ts__extract_year + , subq_6.last_profile_edit_ts__extract_quarter + , subq_6.last_profile_edit_ts__extract_month + , subq_6.last_profile_edit_ts__extract_day + , subq_6.last_profile_edit_ts__extract_dow + , subq_6.last_profile_edit_ts__extract_doy + , subq_6.bio_added_ts__second + , subq_6.bio_added_ts__minute + , subq_6.bio_added_ts__hour + , subq_6.bio_added_ts__day + , subq_6.bio_added_ts__week + , subq_6.bio_added_ts__month + , subq_6.bio_added_ts__quarter + , subq_6.bio_added_ts__year + , subq_6.bio_added_ts__extract_year + , subq_6.bio_added_ts__extract_quarter + , subq_6.bio_added_ts__extract_month + , subq_6.bio_added_ts__extract_day + , subq_6.bio_added_ts__extract_dow + , subq_6.bio_added_ts__extract_doy + , subq_6.last_login_ts__minute + , subq_6.last_login_ts__hour + , subq_6.last_login_ts__day + , subq_6.last_login_ts__week + , subq_6.last_login_ts__month + , subq_6.last_login_ts__quarter + , subq_6.last_login_ts__year + , subq_6.last_login_ts__extract_year + , subq_6.last_login_ts__extract_quarter + , subq_6.last_login_ts__extract_month + , subq_6.last_login_ts__extract_day + , subq_6.last_login_ts__extract_dow + , subq_6.last_login_ts__extract_doy + , subq_6.archived_at__hour + , subq_6.archived_at__day + , subq_6.archived_at__week + , subq_6.archived_at__month + , subq_6.archived_at__quarter + , subq_6.archived_at__year + , subq_6.archived_at__extract_year + , subq_6.archived_at__extract_quarter + , subq_6.archived_at__extract_month + , subq_6.archived_at__extract_day + , subq_6.archived_at__extract_dow + , subq_6.archived_at__extract_doy + , subq_6.user__ds__day + , subq_6.user__ds__week + , subq_6.user__ds__month + , subq_6.user__ds__quarter + , subq_6.user__ds__year + , subq_6.user__ds__extract_year + , subq_6.user__ds__extract_quarter + , subq_6.user__ds__extract_month + , subq_6.user__ds__extract_day + , subq_6.user__ds__extract_dow + , subq_6.user__ds__extract_doy + , subq_6.user__created_at__day + , subq_6.user__created_at__week + , subq_6.user__created_at__month + , subq_6.user__created_at__quarter + , subq_6.user__created_at__year + , subq_6.user__created_at__extract_year + , subq_6.user__created_at__extract_quarter + , subq_6.user__created_at__extract_month + , subq_6.user__created_at__extract_day + , subq_6.user__created_at__extract_dow + , subq_6.user__created_at__extract_doy + , subq_6.user__ds_partitioned__day + , subq_6.user__ds_partitioned__week + , subq_6.user__ds_partitioned__month + , subq_6.user__ds_partitioned__quarter + , subq_6.user__ds_partitioned__year + , subq_6.user__ds_partitioned__extract_year + , subq_6.user__ds_partitioned__extract_quarter + , subq_6.user__ds_partitioned__extract_month + , subq_6.user__ds_partitioned__extract_day + , subq_6.user__ds_partitioned__extract_dow + , subq_6.user__ds_partitioned__extract_doy + , subq_6.user__last_profile_edit_ts__millisecond + , subq_6.user__last_profile_edit_ts__second + , subq_6.user__last_profile_edit_ts__minute + , subq_6.user__last_profile_edit_ts__hour + , subq_6.user__last_profile_edit_ts__day + , subq_6.user__last_profile_edit_ts__week + , subq_6.user__last_profile_edit_ts__month + , subq_6.user__last_profile_edit_ts__quarter + , subq_6.user__last_profile_edit_ts__year + , subq_6.user__last_profile_edit_ts__extract_year + , subq_6.user__last_profile_edit_ts__extract_quarter + , subq_6.user__last_profile_edit_ts__extract_month + , subq_6.user__last_profile_edit_ts__extract_day + , subq_6.user__last_profile_edit_ts__extract_dow + , subq_6.user__last_profile_edit_ts__extract_doy + , subq_6.user__bio_added_ts__second + , subq_6.user__bio_added_ts__minute + , subq_6.user__bio_added_ts__hour + , subq_6.user__bio_added_ts__day + , subq_6.user__bio_added_ts__week + , subq_6.user__bio_added_ts__month + , subq_6.user__bio_added_ts__quarter + , subq_6.user__bio_added_ts__year + , subq_6.user__bio_added_ts__extract_year + , subq_6.user__bio_added_ts__extract_quarter + , subq_6.user__bio_added_ts__extract_month + , subq_6.user__bio_added_ts__extract_day + , subq_6.user__bio_added_ts__extract_dow + , subq_6.user__bio_added_ts__extract_doy + , subq_6.user__last_login_ts__minute + , subq_6.user__last_login_ts__hour + , subq_6.user__last_login_ts__day + , subq_6.user__last_login_ts__week + , subq_6.user__last_login_ts__month + , subq_6.user__last_login_ts__quarter + , subq_6.user__last_login_ts__year + , subq_6.user__last_login_ts__extract_year + , subq_6.user__last_login_ts__extract_quarter + , subq_6.user__last_login_ts__extract_month + , subq_6.user__last_login_ts__extract_day + , subq_6.user__last_login_ts__extract_dow + , subq_6.user__last_login_ts__extract_doy + , subq_6.user__archived_at__hour + , subq_6.user__archived_at__day + , subq_6.user__archived_at__week + , subq_6.user__archived_at__month + , subq_6.user__archived_at__quarter + , subq_6.user__archived_at__year + , subq_6.user__archived_at__extract_year + , subq_6.user__archived_at__extract_quarter + , subq_6.user__archived_at__extract_month + , subq_6.user__archived_at__extract_day + , subq_6.user__archived_at__extract_dow + , subq_6.user__archived_at__extract_doy + , subq_6.metric_time__day + , subq_6.metric_time__week + , subq_6.metric_time__month + , subq_6.metric_time__quarter + , subq_6.metric_time__year + , subq_6.metric_time__extract_year + , subq_6.metric_time__extract_quarter + , subq_6.metric_time__extract_month + , subq_6.metric_time__extract_day + , subq_6.metric_time__extract_dow + , subq_6.metric_time__extract_doy + , subq_6.user + , subq_6.home_state + , subq_6.user__home_state + FROM ( + -- Metric Time Dimension 'created_at' + SELECT + subq_5.ds__day + , subq_5.ds__week + , subq_5.ds__month + , subq_5.ds__quarter + , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_day + , subq_5.ds__extract_dow + , subq_5.ds__extract_doy + , subq_5.created_at__day + , subq_5.created_at__week + , subq_5.created_at__month + , subq_5.created_at__quarter + , subq_5.created_at__year + , subq_5.created_at__extract_year + , subq_5.created_at__extract_quarter + , subq_5.created_at__extract_month + , subq_5.created_at__extract_day + , subq_5.created_at__extract_dow + , subq_5.created_at__extract_doy + , subq_5.ds_partitioned__day + , subq_5.ds_partitioned__week + , subq_5.ds_partitioned__month + , subq_5.ds_partitioned__quarter + , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dow + , subq_5.ds_partitioned__extract_doy + , subq_5.last_profile_edit_ts__millisecond + , subq_5.last_profile_edit_ts__second + , subq_5.last_profile_edit_ts__minute + , subq_5.last_profile_edit_ts__hour + , subq_5.last_profile_edit_ts__day + , subq_5.last_profile_edit_ts__week + , subq_5.last_profile_edit_ts__month + , subq_5.last_profile_edit_ts__quarter + , subq_5.last_profile_edit_ts__year + , subq_5.last_profile_edit_ts__extract_year + , subq_5.last_profile_edit_ts__extract_quarter + , subq_5.last_profile_edit_ts__extract_month + , subq_5.last_profile_edit_ts__extract_day + , subq_5.last_profile_edit_ts__extract_dow + , subq_5.last_profile_edit_ts__extract_doy + , subq_5.bio_added_ts__second + , subq_5.bio_added_ts__minute + , subq_5.bio_added_ts__hour + , subq_5.bio_added_ts__day + , subq_5.bio_added_ts__week + , subq_5.bio_added_ts__month + , subq_5.bio_added_ts__quarter + , subq_5.bio_added_ts__year + , subq_5.bio_added_ts__extract_year + , subq_5.bio_added_ts__extract_quarter + , subq_5.bio_added_ts__extract_month + , subq_5.bio_added_ts__extract_day + , subq_5.bio_added_ts__extract_dow + , subq_5.bio_added_ts__extract_doy + , subq_5.last_login_ts__minute + , subq_5.last_login_ts__hour + , subq_5.last_login_ts__day + , subq_5.last_login_ts__week + , subq_5.last_login_ts__month + , subq_5.last_login_ts__quarter + , subq_5.last_login_ts__year + , subq_5.last_login_ts__extract_year + , subq_5.last_login_ts__extract_quarter + , subq_5.last_login_ts__extract_month + , subq_5.last_login_ts__extract_day + , subq_5.last_login_ts__extract_dow + , subq_5.last_login_ts__extract_doy + , subq_5.archived_at__hour + , subq_5.archived_at__day + , subq_5.archived_at__week + , subq_5.archived_at__month + , subq_5.archived_at__quarter + , subq_5.archived_at__year + , subq_5.archived_at__extract_year + , subq_5.archived_at__extract_quarter + , subq_5.archived_at__extract_month + , subq_5.archived_at__extract_day + , subq_5.archived_at__extract_dow + , subq_5.archived_at__extract_doy + , subq_5.user__ds__day + , subq_5.user__ds__week + , subq_5.user__ds__month + , subq_5.user__ds__quarter + , subq_5.user__ds__year + , subq_5.user__ds__extract_year + , subq_5.user__ds__extract_quarter + , subq_5.user__ds__extract_month + , subq_5.user__ds__extract_day + , subq_5.user__ds__extract_dow + , subq_5.user__ds__extract_doy + , subq_5.user__created_at__day + , subq_5.user__created_at__week + , subq_5.user__created_at__month + , subq_5.user__created_at__quarter + , subq_5.user__created_at__year + , subq_5.user__created_at__extract_year + , subq_5.user__created_at__extract_quarter + , subq_5.user__created_at__extract_month + , subq_5.user__created_at__extract_day + , subq_5.user__created_at__extract_dow + , subq_5.user__created_at__extract_doy + , subq_5.user__ds_partitioned__day + , subq_5.user__ds_partitioned__week + , subq_5.user__ds_partitioned__month + , subq_5.user__ds_partitioned__quarter + , subq_5.user__ds_partitioned__year + , subq_5.user__ds_partitioned__extract_year + , subq_5.user__ds_partitioned__extract_quarter + , subq_5.user__ds_partitioned__extract_month + , subq_5.user__ds_partitioned__extract_day + , subq_5.user__ds_partitioned__extract_dow + , subq_5.user__ds_partitioned__extract_doy + , subq_5.user__last_profile_edit_ts__millisecond + , subq_5.user__last_profile_edit_ts__second + , subq_5.user__last_profile_edit_ts__minute + , subq_5.user__last_profile_edit_ts__hour + , subq_5.user__last_profile_edit_ts__day + , subq_5.user__last_profile_edit_ts__week + , subq_5.user__last_profile_edit_ts__month + , subq_5.user__last_profile_edit_ts__quarter + , subq_5.user__last_profile_edit_ts__year + , subq_5.user__last_profile_edit_ts__extract_year + , subq_5.user__last_profile_edit_ts__extract_quarter + , subq_5.user__last_profile_edit_ts__extract_month + , subq_5.user__last_profile_edit_ts__extract_day + , subq_5.user__last_profile_edit_ts__extract_dow + , subq_5.user__last_profile_edit_ts__extract_doy + , subq_5.user__bio_added_ts__second + , subq_5.user__bio_added_ts__minute + , subq_5.user__bio_added_ts__hour + , subq_5.user__bio_added_ts__day + , subq_5.user__bio_added_ts__week + , subq_5.user__bio_added_ts__month + , subq_5.user__bio_added_ts__quarter + , subq_5.user__bio_added_ts__year + , subq_5.user__bio_added_ts__extract_year + , subq_5.user__bio_added_ts__extract_quarter + , subq_5.user__bio_added_ts__extract_month + , subq_5.user__bio_added_ts__extract_day + , subq_5.user__bio_added_ts__extract_dow + , subq_5.user__bio_added_ts__extract_doy + , subq_5.user__last_login_ts__minute + , subq_5.user__last_login_ts__hour + , subq_5.user__last_login_ts__day + , subq_5.user__last_login_ts__week + , subq_5.user__last_login_ts__month + , subq_5.user__last_login_ts__quarter + , subq_5.user__last_login_ts__year + , subq_5.user__last_login_ts__extract_year + , subq_5.user__last_login_ts__extract_quarter + , subq_5.user__last_login_ts__extract_month + , subq_5.user__last_login_ts__extract_day + , subq_5.user__last_login_ts__extract_dow + , subq_5.user__last_login_ts__extract_doy + , subq_5.user__archived_at__hour + , subq_5.user__archived_at__day + , subq_5.user__archived_at__week + , subq_5.user__archived_at__month + , subq_5.user__archived_at__quarter + , subq_5.user__archived_at__year + , subq_5.user__archived_at__extract_year + , subq_5.user__archived_at__extract_quarter + , subq_5.user__archived_at__extract_month + , subq_5.user__archived_at__extract_day + , subq_5.user__archived_at__extract_dow + , subq_5.user__archived_at__extract_doy + , subq_5.created_at__day AS metric_time__day + , subq_5.created_at__week AS metric_time__week + , subq_5.created_at__month AS metric_time__month + , subq_5.created_at__quarter AS metric_time__quarter + , subq_5.created_at__year AS metric_time__year + , subq_5.created_at__extract_year AS metric_time__extract_year + , subq_5.created_at__extract_quarter AS metric_time__extract_quarter + , subq_5.created_at__extract_month AS metric_time__extract_month + , subq_5.created_at__extract_day AS metric_time__extract_day + , subq_5.created_at__extract_dow AS metric_time__extract_dow + , subq_5.created_at__extract_doy AS metric_time__extract_doy + , subq_5.user + , subq_5.home_state + , subq_5.user__home_state + , subq_5.new_users + FROM ( + -- Read Elements From Semantic Model 'users_ds_source' + SELECT + 1 AS new_users + , 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_5 + ) subq_6 + ) subq_7 + ON + subq_4.user = subq_7.user + ) subq_8 + ) subq_9 + ON + ( + subq_2.listing = subq_9.listing + ) AND ( + subq_2.ds_partitioned__day = subq_9.user__ds_partitioned__day + ) + ) subq_10 + ) subq_11 + GROUP BY + subq_11.listing__user__bio_added_ts__minute +) subq_12 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql new file mode 100644 index 0000000000..d93a3918ba --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql @@ -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 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_metric_with_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_metric_with_sub_daily_dimension__plan0.sql new file mode 100644 index 0000000000..712a3c0a08 --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_metric_with_sub_daily_dimension__plan0.sql @@ -0,0 +1,394 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.user__archived_at__hour + , subq_3.new_users +FROM ( + -- Aggregate Measures + SELECT + subq_2.user__archived_at__hour + , SUM(subq_2.new_users) AS new_users + FROM ( + -- Pass Only Elements: ['new_users', 'user__archived_at__hour'] + SELECT + subq_1.user__archived_at__hour + , subq_1.new_users + FROM ( + -- Metric Time Dimension 'created_at' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.created_at__day + , subq_0.created_at__week + , subq_0.created_at__month + , subq_0.created_at__quarter + , subq_0.created_at__year + , subq_0.created_at__extract_year + , subq_0.created_at__extract_quarter + , subq_0.created_at__extract_month + , subq_0.created_at__extract_day + , subq_0.created_at__extract_dow + , subq_0.created_at__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.last_profile_edit_ts__millisecond + , subq_0.last_profile_edit_ts__second + , subq_0.last_profile_edit_ts__minute + , subq_0.last_profile_edit_ts__hour + , subq_0.last_profile_edit_ts__day + , subq_0.last_profile_edit_ts__week + , subq_0.last_profile_edit_ts__month + , subq_0.last_profile_edit_ts__quarter + , subq_0.last_profile_edit_ts__year + , subq_0.last_profile_edit_ts__extract_year + , subq_0.last_profile_edit_ts__extract_quarter + , subq_0.last_profile_edit_ts__extract_month + , subq_0.last_profile_edit_ts__extract_day + , subq_0.last_profile_edit_ts__extract_dow + , subq_0.last_profile_edit_ts__extract_doy + , subq_0.bio_added_ts__second + , subq_0.bio_added_ts__minute + , subq_0.bio_added_ts__hour + , subq_0.bio_added_ts__day + , subq_0.bio_added_ts__week + , subq_0.bio_added_ts__month + , subq_0.bio_added_ts__quarter + , subq_0.bio_added_ts__year + , subq_0.bio_added_ts__extract_year + , subq_0.bio_added_ts__extract_quarter + , subq_0.bio_added_ts__extract_month + , subq_0.bio_added_ts__extract_day + , subq_0.bio_added_ts__extract_dow + , subq_0.bio_added_ts__extract_doy + , subq_0.last_login_ts__minute + , subq_0.last_login_ts__hour + , subq_0.last_login_ts__day + , subq_0.last_login_ts__week + , subq_0.last_login_ts__month + , subq_0.last_login_ts__quarter + , subq_0.last_login_ts__year + , subq_0.last_login_ts__extract_year + , subq_0.last_login_ts__extract_quarter + , subq_0.last_login_ts__extract_month + , subq_0.last_login_ts__extract_day + , subq_0.last_login_ts__extract_dow + , subq_0.last_login_ts__extract_doy + , subq_0.archived_at__hour + , subq_0.archived_at__day + , subq_0.archived_at__week + , subq_0.archived_at__month + , subq_0.archived_at__quarter + , subq_0.archived_at__year + , subq_0.archived_at__extract_year + , subq_0.archived_at__extract_quarter + , subq_0.archived_at__extract_month + , subq_0.archived_at__extract_day + , subq_0.archived_at__extract_dow + , subq_0.archived_at__extract_doy + , subq_0.user__ds__day + , subq_0.user__ds__week + , subq_0.user__ds__month + , subq_0.user__ds__quarter + , subq_0.user__ds__year + , subq_0.user__ds__extract_year + , subq_0.user__ds__extract_quarter + , subq_0.user__ds__extract_month + , subq_0.user__ds__extract_day + , subq_0.user__ds__extract_dow + , subq_0.user__ds__extract_doy + , subq_0.user__created_at__day + , subq_0.user__created_at__week + , subq_0.user__created_at__month + , subq_0.user__created_at__quarter + , subq_0.user__created_at__year + , subq_0.user__created_at__extract_year + , subq_0.user__created_at__extract_quarter + , subq_0.user__created_at__extract_month + , subq_0.user__created_at__extract_day + , subq_0.user__created_at__extract_dow + , subq_0.user__created_at__extract_doy + , subq_0.user__ds_partitioned__day + , subq_0.user__ds_partitioned__week + , subq_0.user__ds_partitioned__month + , subq_0.user__ds_partitioned__quarter + , subq_0.user__ds_partitioned__year + , subq_0.user__ds_partitioned__extract_year + , subq_0.user__ds_partitioned__extract_quarter + , subq_0.user__ds_partitioned__extract_month + , subq_0.user__ds_partitioned__extract_day + , subq_0.user__ds_partitioned__extract_dow + , subq_0.user__ds_partitioned__extract_doy + , subq_0.user__last_profile_edit_ts__millisecond + , subq_0.user__last_profile_edit_ts__second + , subq_0.user__last_profile_edit_ts__minute + , subq_0.user__last_profile_edit_ts__hour + , subq_0.user__last_profile_edit_ts__day + , subq_0.user__last_profile_edit_ts__week + , subq_0.user__last_profile_edit_ts__month + , subq_0.user__last_profile_edit_ts__quarter + , subq_0.user__last_profile_edit_ts__year + , subq_0.user__last_profile_edit_ts__extract_year + , subq_0.user__last_profile_edit_ts__extract_quarter + , subq_0.user__last_profile_edit_ts__extract_month + , subq_0.user__last_profile_edit_ts__extract_day + , subq_0.user__last_profile_edit_ts__extract_dow + , subq_0.user__last_profile_edit_ts__extract_doy + , subq_0.user__bio_added_ts__second + , subq_0.user__bio_added_ts__minute + , subq_0.user__bio_added_ts__hour + , subq_0.user__bio_added_ts__day + , subq_0.user__bio_added_ts__week + , subq_0.user__bio_added_ts__month + , subq_0.user__bio_added_ts__quarter + , subq_0.user__bio_added_ts__year + , subq_0.user__bio_added_ts__extract_year + , subq_0.user__bio_added_ts__extract_quarter + , subq_0.user__bio_added_ts__extract_month + , subq_0.user__bio_added_ts__extract_day + , subq_0.user__bio_added_ts__extract_dow + , subq_0.user__bio_added_ts__extract_doy + , subq_0.user__last_login_ts__minute + , subq_0.user__last_login_ts__hour + , subq_0.user__last_login_ts__day + , subq_0.user__last_login_ts__week + , subq_0.user__last_login_ts__month + , subq_0.user__last_login_ts__quarter + , subq_0.user__last_login_ts__year + , subq_0.user__last_login_ts__extract_year + , subq_0.user__last_login_ts__extract_quarter + , subq_0.user__last_login_ts__extract_month + , subq_0.user__last_login_ts__extract_day + , subq_0.user__last_login_ts__extract_dow + , subq_0.user__last_login_ts__extract_doy + , subq_0.user__archived_at__hour + , subq_0.user__archived_at__day + , subq_0.user__archived_at__week + , subq_0.user__archived_at__month + , subq_0.user__archived_at__quarter + , subq_0.user__archived_at__year + , subq_0.user__archived_at__extract_year + , subq_0.user__archived_at__extract_quarter + , subq_0.user__archived_at__extract_month + , subq_0.user__archived_at__extract_day + , subq_0.user__archived_at__extract_dow + , subq_0.user__archived_at__extract_doy + , subq_0.created_at__day AS metric_time__day + , subq_0.created_at__week AS metric_time__week + , subq_0.created_at__month AS metric_time__month + , subq_0.created_at__quarter AS metric_time__quarter + , subq_0.created_at__year AS metric_time__year + , subq_0.created_at__extract_year AS metric_time__extract_year + , subq_0.created_at__extract_quarter AS metric_time__extract_quarter + , subq_0.created_at__extract_month AS metric_time__extract_month + , subq_0.created_at__extract_day AS metric_time__extract_day + , subq_0.created_at__extract_dow AS metric_time__extract_dow + , subq_0.created_at__extract_doy AS metric_time__extract_doy + , subq_0.user + , subq_0.home_state + , subq_0.user__home_state + , subq_0.new_users + FROM ( + -- Read Elements From Semantic Model 'users_ds_source' + SELECT + 1 AS new_users + , 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 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.user__archived_at__hour +) subq_3 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql new file mode 100644 index 0000000000..c20146c881 --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql @@ -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 + DATE_TRUNC('hour', archived_at) 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 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql new file mode 100644 index 0000000000..29201c396e --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql @@ -0,0 +1,1303 @@ +-- Compute Metrics via Expressions +SELECT + subq_12.listing__user__bio_added_ts__minute + , subq_12.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_11.listing__user__bio_added_ts__minute + , SUM(subq_11.bookings) AS bookings + FROM ( + -- Pass Only Elements: ['bookings', 'listing__user__bio_added_ts__minute'] + SELECT + subq_10.listing__user__bio_added_ts__minute + , subq_10.bookings + FROM ( + -- Join Standard Outputs + SELECT + subq_2.ds_partitioned__day AS ds_partitioned__day + , subq_9.user__ds_partitioned__day AS listing__user__ds_partitioned__day + , subq_9.user__bio_added_ts__minute AS listing__user__bio_added_ts__minute + , subq_2.listing AS listing + , subq_2.bookings AS bookings + FROM ( + -- Pass Only Elements: ['bookings', 'ds_partitioned__day', 'listing'] + SELECT + subq_1.ds_partitioned__day + , subq_1.listing + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_28000.booking_value + , bookings_source_src_28000.booking_value AS max_booking_value + , bookings_source_src_28000.booking_value AS min_booking_value + , bookings_source_src_28000.guest_id AS bookers + , bookings_source_src_28000.booking_value AS average_booking_value + , bookings_source_src_28000.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_28000.booking_value AS median_booking_value + , bookings_source_src_28000.booking_value AS booking_value_p99 + , bookings_source_src_28000.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28000.is_instant + , DATE_TRUNC('day', bookings_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy + , bookings_source_src_28000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day + , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28000.listing_id AS listing + , bookings_source_src_28000.guest_id AS guest + , bookings_source_src_28000.host_id AS host + , bookings_source_src_28000.listing_id AS booking__listing + , bookings_source_src_28000.guest_id AS booking__guest + , bookings_source_src_28000.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28000 + ) subq_0 + ) subq_1 + ) subq_2 + LEFT OUTER JOIN ( + -- Pass Only Elements: ['user__ds_partitioned__day', 'user__bio_added_ts__minute', 'listing'] + SELECT + subq_8.user__ds_partitioned__day + , subq_8.user__bio_added_ts__minute + , subq_8.listing + FROM ( + -- Join Standard Outputs + SELECT + subq_4.ds__day AS ds__day + , subq_4.ds__week AS ds__week + , subq_4.ds__month AS ds__month + , subq_4.ds__quarter AS ds__quarter + , subq_4.ds__year AS ds__year + , subq_4.ds__extract_year AS ds__extract_year + , subq_4.ds__extract_quarter AS ds__extract_quarter + , subq_4.ds__extract_month AS ds__extract_month + , subq_4.ds__extract_day AS ds__extract_day + , subq_4.ds__extract_dow AS ds__extract_dow + , subq_4.ds__extract_doy AS ds__extract_doy + , subq_4.created_at__day AS created_at__day + , subq_4.created_at__week AS created_at__week + , subq_4.created_at__month AS created_at__month + , subq_4.created_at__quarter AS created_at__quarter + , subq_4.created_at__year AS created_at__year + , subq_4.created_at__extract_year AS created_at__extract_year + , subq_4.created_at__extract_quarter AS created_at__extract_quarter + , subq_4.created_at__extract_month AS created_at__extract_month + , subq_4.created_at__extract_day AS created_at__extract_day + , subq_4.created_at__extract_dow AS created_at__extract_dow + , subq_4.created_at__extract_doy AS created_at__extract_doy + , subq_4.listing__ds__day AS listing__ds__day + , subq_4.listing__ds__week AS listing__ds__week + , subq_4.listing__ds__month AS listing__ds__month + , subq_4.listing__ds__quarter AS listing__ds__quarter + , subq_4.listing__ds__year AS listing__ds__year + , subq_4.listing__ds__extract_year AS listing__ds__extract_year + , subq_4.listing__ds__extract_quarter AS listing__ds__extract_quarter + , subq_4.listing__ds__extract_month AS listing__ds__extract_month + , subq_4.listing__ds__extract_day AS listing__ds__extract_day + , subq_4.listing__ds__extract_dow AS listing__ds__extract_dow + , subq_4.listing__ds__extract_doy AS listing__ds__extract_doy + , subq_4.listing__created_at__day AS listing__created_at__day + , subq_4.listing__created_at__week AS listing__created_at__week + , subq_4.listing__created_at__month AS listing__created_at__month + , subq_4.listing__created_at__quarter AS listing__created_at__quarter + , subq_4.listing__created_at__year AS listing__created_at__year + , subq_4.listing__created_at__extract_year AS listing__created_at__extract_year + , subq_4.listing__created_at__extract_quarter AS listing__created_at__extract_quarter + , subq_4.listing__created_at__extract_month AS listing__created_at__extract_month + , subq_4.listing__created_at__extract_day AS listing__created_at__extract_day + , subq_4.listing__created_at__extract_dow AS listing__created_at__extract_dow + , subq_4.listing__created_at__extract_doy AS listing__created_at__extract_doy + , subq_4.metric_time__day AS metric_time__day + , 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_7.ds__day AS user__ds__day + , subq_7.ds__week AS user__ds__week + , subq_7.ds__month AS user__ds__month + , subq_7.ds__quarter AS user__ds__quarter + , subq_7.ds__year AS user__ds__year + , subq_7.ds__extract_year AS user__ds__extract_year + , subq_7.ds__extract_quarter AS user__ds__extract_quarter + , subq_7.ds__extract_month AS user__ds__extract_month + , subq_7.ds__extract_day AS user__ds__extract_day + , subq_7.ds__extract_dow AS user__ds__extract_dow + , subq_7.ds__extract_doy AS user__ds__extract_doy + , subq_7.created_at__day AS user__created_at__day + , subq_7.created_at__week AS user__created_at__week + , subq_7.created_at__month AS user__created_at__month + , subq_7.created_at__quarter AS user__created_at__quarter + , subq_7.created_at__year AS user__created_at__year + , subq_7.created_at__extract_year AS user__created_at__extract_year + , subq_7.created_at__extract_quarter AS user__created_at__extract_quarter + , subq_7.created_at__extract_month AS user__created_at__extract_month + , subq_7.created_at__extract_day AS user__created_at__extract_day + , subq_7.created_at__extract_dow AS user__created_at__extract_dow + , subq_7.created_at__extract_doy AS user__created_at__extract_doy + , subq_7.ds_partitioned__day AS user__ds_partitioned__day + , subq_7.ds_partitioned__week AS user__ds_partitioned__week + , subq_7.ds_partitioned__month AS user__ds_partitioned__month + , subq_7.ds_partitioned__quarter AS user__ds_partitioned__quarter + , subq_7.ds_partitioned__year AS user__ds_partitioned__year + , subq_7.ds_partitioned__extract_year AS user__ds_partitioned__extract_year + , subq_7.ds_partitioned__extract_quarter AS user__ds_partitioned__extract_quarter + , subq_7.ds_partitioned__extract_month AS user__ds_partitioned__extract_month + , subq_7.ds_partitioned__extract_day AS user__ds_partitioned__extract_day + , subq_7.ds_partitioned__extract_dow AS user__ds_partitioned__extract_dow + , subq_7.ds_partitioned__extract_doy AS user__ds_partitioned__extract_doy + , subq_7.last_profile_edit_ts__millisecond AS user__last_profile_edit_ts__millisecond + , subq_7.last_profile_edit_ts__second AS user__last_profile_edit_ts__second + , subq_7.last_profile_edit_ts__minute AS user__last_profile_edit_ts__minute + , subq_7.last_profile_edit_ts__hour AS user__last_profile_edit_ts__hour + , subq_7.last_profile_edit_ts__day AS user__last_profile_edit_ts__day + , subq_7.last_profile_edit_ts__week AS user__last_profile_edit_ts__week + , subq_7.last_profile_edit_ts__month AS user__last_profile_edit_ts__month + , subq_7.last_profile_edit_ts__quarter AS user__last_profile_edit_ts__quarter + , subq_7.last_profile_edit_ts__year AS user__last_profile_edit_ts__year + , subq_7.last_profile_edit_ts__extract_year AS user__last_profile_edit_ts__extract_year + , subq_7.last_profile_edit_ts__extract_quarter AS user__last_profile_edit_ts__extract_quarter + , subq_7.last_profile_edit_ts__extract_month AS user__last_profile_edit_ts__extract_month + , subq_7.last_profile_edit_ts__extract_day AS user__last_profile_edit_ts__extract_day + , subq_7.last_profile_edit_ts__extract_dow AS user__last_profile_edit_ts__extract_dow + , subq_7.last_profile_edit_ts__extract_doy AS user__last_profile_edit_ts__extract_doy + , subq_7.bio_added_ts__second AS user__bio_added_ts__second + , subq_7.bio_added_ts__minute AS user__bio_added_ts__minute + , subq_7.bio_added_ts__hour AS user__bio_added_ts__hour + , subq_7.bio_added_ts__day AS user__bio_added_ts__day + , subq_7.bio_added_ts__week AS user__bio_added_ts__week + , subq_7.bio_added_ts__month AS user__bio_added_ts__month + , subq_7.bio_added_ts__quarter AS user__bio_added_ts__quarter + , subq_7.bio_added_ts__year AS user__bio_added_ts__year + , subq_7.bio_added_ts__extract_year AS user__bio_added_ts__extract_year + , subq_7.bio_added_ts__extract_quarter AS user__bio_added_ts__extract_quarter + , subq_7.bio_added_ts__extract_month AS user__bio_added_ts__extract_month + , subq_7.bio_added_ts__extract_day AS user__bio_added_ts__extract_day + , subq_7.bio_added_ts__extract_dow AS user__bio_added_ts__extract_dow + , subq_7.bio_added_ts__extract_doy AS user__bio_added_ts__extract_doy + , subq_7.last_login_ts__minute AS user__last_login_ts__minute + , subq_7.last_login_ts__hour AS user__last_login_ts__hour + , subq_7.last_login_ts__day AS user__last_login_ts__day + , subq_7.last_login_ts__week AS user__last_login_ts__week + , subq_7.last_login_ts__month AS user__last_login_ts__month + , subq_7.last_login_ts__quarter AS user__last_login_ts__quarter + , subq_7.last_login_ts__year AS user__last_login_ts__year + , subq_7.last_login_ts__extract_year AS user__last_login_ts__extract_year + , subq_7.last_login_ts__extract_quarter AS user__last_login_ts__extract_quarter + , subq_7.last_login_ts__extract_month AS user__last_login_ts__extract_month + , subq_7.last_login_ts__extract_day AS user__last_login_ts__extract_day + , subq_7.last_login_ts__extract_dow AS user__last_login_ts__extract_dow + , subq_7.last_login_ts__extract_doy AS user__last_login_ts__extract_doy + , subq_7.archived_at__hour AS user__archived_at__hour + , subq_7.archived_at__day AS user__archived_at__day + , subq_7.archived_at__week AS user__archived_at__week + , subq_7.archived_at__month AS user__archived_at__month + , subq_7.archived_at__quarter AS user__archived_at__quarter + , subq_7.archived_at__year AS user__archived_at__year + , subq_7.archived_at__extract_year AS user__archived_at__extract_year + , subq_7.archived_at__extract_quarter AS user__archived_at__extract_quarter + , subq_7.archived_at__extract_month AS user__archived_at__extract_month + , subq_7.archived_at__extract_day AS user__archived_at__extract_day + , subq_7.archived_at__extract_dow AS user__archived_at__extract_dow + , subq_7.archived_at__extract_doy AS user__archived_at__extract_doy + , subq_7.metric_time__day AS user__metric_time__day + , subq_7.metric_time__week AS user__metric_time__week + , subq_7.metric_time__month AS user__metric_time__month + , subq_7.metric_time__quarter AS user__metric_time__quarter + , subq_7.metric_time__year AS user__metric_time__year + , subq_7.metric_time__extract_year AS user__metric_time__extract_year + , subq_7.metric_time__extract_quarter AS user__metric_time__extract_quarter + , subq_7.metric_time__extract_month AS user__metric_time__extract_month + , subq_7.metric_time__extract_day AS user__metric_time__extract_day + , subq_7.metric_time__extract_dow AS user__metric_time__extract_dow + , subq_7.metric_time__extract_doy AS user__metric_time__extract_doy + , subq_4.listing AS listing + , subq_4.user AS user + , subq_4.listing__user AS listing__user + , subq_4.country_latest AS country_latest + , subq_4.is_lux_latest AS is_lux_latest + , subq_4.capacity_latest AS capacity_latest + , subq_4.listing__country_latest AS listing__country_latest + , subq_4.listing__is_lux_latest AS listing__is_lux_latest + , subq_4.listing__capacity_latest AS listing__capacity_latest + , subq_7.home_state AS user__home_state + , subq_4.listings AS listings + , subq_4.largest_listing AS largest_listing + , subq_4.smallest_listing AS smallest_listing + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_3.ds__day + , subq_3.ds__week + , subq_3.ds__month + , subq_3.ds__quarter + , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_day + , subq_3.ds__extract_dow + , subq_3.ds__extract_doy + , subq_3.created_at__day + , subq_3.created_at__week + , subq_3.created_at__month + , subq_3.created_at__quarter + , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy + , subq_3.listing__ds__day + , subq_3.listing__ds__week + , subq_3.listing__ds__month + , subq_3.listing__ds__quarter + , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dow + , subq_3.listing__ds__extract_doy + , subq_3.listing__created_at__day + , subq_3.listing__created_at__week + , subq_3.listing__created_at__month + , subq_3.listing__created_at__quarter + , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dow + , subq_3.listing__created_at__extract_doy + , subq_3.ds__day AS metric_time__day + , subq_3.ds__week AS metric_time__week + , subq_3.ds__month AS metric_time__month + , subq_3.ds__quarter AS metric_time__quarter + , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy + , subq_3.listing + , subq_3.user + , subq_3.listing__user + , subq_3.country_latest + , subq_3.is_lux_latest + , subq_3.capacity_latest + , subq_3.listing__country_latest + , subq_3.listing__is_lux_latest + , subq_3.listing__capacity_latest + , subq_3.listings + , subq_3.largest_listing + , subq_3.smallest_listing + FROM ( + -- Read Elements From Semantic Model 'listings_latest' + SELECT + 1 AS listings + , listings_latest_src_28000.capacity AS largest_listing + , listings_latest_src_28000.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS created_at__extract_dow + , EXTRACT(doy 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 + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__created_at__extract_dow + , EXTRACT(doy 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 + FROM ***************************.dim_listings_latest listings_latest_src_28000 + ) subq_3 + ) subq_4 + LEFT OUTER JOIN ( + -- Pass Only Elements: [ + -- 'home_state', + -- 'user__home_state', + -- 'ds__day', + -- 'ds__week', + -- 'ds__month', + -- 'ds__quarter', + -- 'ds__year', + -- 'ds__extract_year', + -- 'ds__extract_quarter', + -- 'ds__extract_month', + -- 'ds__extract_day', + -- 'ds__extract_dow', + -- 'ds__extract_doy', + -- 'created_at__day', + -- 'created_at__week', + -- 'created_at__month', + -- 'created_at__quarter', + -- 'created_at__year', + -- 'created_at__extract_year', + -- 'created_at__extract_quarter', + -- 'created_at__extract_month', + -- 'created_at__extract_day', + -- 'created_at__extract_dow', + -- 'created_at__extract_doy', + -- 'ds_partitioned__day', + -- 'ds_partitioned__week', + -- 'ds_partitioned__month', + -- 'ds_partitioned__quarter', + -- 'ds_partitioned__year', + -- 'ds_partitioned__extract_year', + -- 'ds_partitioned__extract_quarter', + -- 'ds_partitioned__extract_month', + -- 'ds_partitioned__extract_day', + -- 'ds_partitioned__extract_dow', + -- 'ds_partitioned__extract_doy', + -- 'last_profile_edit_ts__millisecond', + -- 'last_profile_edit_ts__second', + -- 'last_profile_edit_ts__minute', + -- 'last_profile_edit_ts__hour', + -- 'last_profile_edit_ts__day', + -- 'last_profile_edit_ts__week', + -- 'last_profile_edit_ts__month', + -- 'last_profile_edit_ts__quarter', + -- 'last_profile_edit_ts__year', + -- 'last_profile_edit_ts__extract_year', + -- 'last_profile_edit_ts__extract_quarter', + -- 'last_profile_edit_ts__extract_month', + -- 'last_profile_edit_ts__extract_day', + -- 'last_profile_edit_ts__extract_dow', + -- 'last_profile_edit_ts__extract_doy', + -- 'bio_added_ts__second', + -- 'bio_added_ts__minute', + -- 'bio_added_ts__hour', + -- 'bio_added_ts__day', + -- 'bio_added_ts__week', + -- 'bio_added_ts__month', + -- 'bio_added_ts__quarter', + -- 'bio_added_ts__year', + -- 'bio_added_ts__extract_year', + -- 'bio_added_ts__extract_quarter', + -- 'bio_added_ts__extract_month', + -- 'bio_added_ts__extract_day', + -- 'bio_added_ts__extract_dow', + -- 'bio_added_ts__extract_doy', + -- 'last_login_ts__minute', + -- 'last_login_ts__hour', + -- 'last_login_ts__day', + -- 'last_login_ts__week', + -- 'last_login_ts__month', + -- 'last_login_ts__quarter', + -- 'last_login_ts__year', + -- 'last_login_ts__extract_year', + -- 'last_login_ts__extract_quarter', + -- 'last_login_ts__extract_month', + -- 'last_login_ts__extract_day', + -- 'last_login_ts__extract_dow', + -- 'last_login_ts__extract_doy', + -- 'archived_at__hour', + -- 'archived_at__day', + -- 'archived_at__week', + -- 'archived_at__month', + -- 'archived_at__quarter', + -- 'archived_at__year', + -- 'archived_at__extract_year', + -- 'archived_at__extract_quarter', + -- 'archived_at__extract_month', + -- 'archived_at__extract_day', + -- 'archived_at__extract_dow', + -- 'archived_at__extract_doy', + -- 'user__ds__day', + -- 'user__ds__week', + -- 'user__ds__month', + -- 'user__ds__quarter', + -- 'user__ds__year', + -- 'user__ds__extract_year', + -- 'user__ds__extract_quarter', + -- 'user__ds__extract_month', + -- 'user__ds__extract_day', + -- 'user__ds__extract_dow', + -- 'user__ds__extract_doy', + -- 'user__created_at__day', + -- 'user__created_at__week', + -- 'user__created_at__month', + -- 'user__created_at__quarter', + -- 'user__created_at__year', + -- 'user__created_at__extract_year', + -- 'user__created_at__extract_quarter', + -- 'user__created_at__extract_month', + -- 'user__created_at__extract_day', + -- 'user__created_at__extract_dow', + -- 'user__created_at__extract_doy', + -- 'user__ds_partitioned__day', + -- 'user__ds_partitioned__week', + -- 'user__ds_partitioned__month', + -- 'user__ds_partitioned__quarter', + -- 'user__ds_partitioned__year', + -- 'user__ds_partitioned__extract_year', + -- 'user__ds_partitioned__extract_quarter', + -- 'user__ds_partitioned__extract_month', + -- 'user__ds_partitioned__extract_day', + -- 'user__ds_partitioned__extract_dow', + -- 'user__ds_partitioned__extract_doy', + -- 'user__last_profile_edit_ts__millisecond', + -- 'user__last_profile_edit_ts__second', + -- 'user__last_profile_edit_ts__minute', + -- 'user__last_profile_edit_ts__hour', + -- 'user__last_profile_edit_ts__day', + -- 'user__last_profile_edit_ts__week', + -- 'user__last_profile_edit_ts__month', + -- 'user__last_profile_edit_ts__quarter', + -- 'user__last_profile_edit_ts__year', + -- 'user__last_profile_edit_ts__extract_year', + -- 'user__last_profile_edit_ts__extract_quarter', + -- 'user__last_profile_edit_ts__extract_month', + -- 'user__last_profile_edit_ts__extract_day', + -- 'user__last_profile_edit_ts__extract_dow', + -- 'user__last_profile_edit_ts__extract_doy', + -- 'user__bio_added_ts__second', + -- 'user__bio_added_ts__minute', + -- 'user__bio_added_ts__hour', + -- 'user__bio_added_ts__day', + -- 'user__bio_added_ts__week', + -- 'user__bio_added_ts__month', + -- 'user__bio_added_ts__quarter', + -- 'user__bio_added_ts__year', + -- 'user__bio_added_ts__extract_year', + -- 'user__bio_added_ts__extract_quarter', + -- 'user__bio_added_ts__extract_month', + -- 'user__bio_added_ts__extract_day', + -- 'user__bio_added_ts__extract_dow', + -- 'user__bio_added_ts__extract_doy', + -- 'user__last_login_ts__minute', + -- 'user__last_login_ts__hour', + -- 'user__last_login_ts__day', + -- 'user__last_login_ts__week', + -- 'user__last_login_ts__month', + -- 'user__last_login_ts__quarter', + -- 'user__last_login_ts__year', + -- 'user__last_login_ts__extract_year', + -- 'user__last_login_ts__extract_quarter', + -- 'user__last_login_ts__extract_month', + -- 'user__last_login_ts__extract_day', + -- 'user__last_login_ts__extract_dow', + -- 'user__last_login_ts__extract_doy', + -- 'user__archived_at__hour', + -- 'user__archived_at__day', + -- 'user__archived_at__week', + -- 'user__archived_at__month', + -- 'user__archived_at__quarter', + -- 'user__archived_at__year', + -- 'user__archived_at__extract_year', + -- 'user__archived_at__extract_quarter', + -- 'user__archived_at__extract_month', + -- 'user__archived_at__extract_day', + -- 'user__archived_at__extract_dow', + -- 'user__archived_at__extract_doy', + -- 'metric_time__day', + -- 'metric_time__week', + -- 'metric_time__month', + -- 'metric_time__quarter', + -- 'metric_time__year', + -- 'metric_time__extract_year', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_month', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'user', + -- ] + SELECT + subq_6.ds__day + , subq_6.ds__week + , subq_6.ds__month + , subq_6.ds__quarter + , subq_6.ds__year + , subq_6.ds__extract_year + , subq_6.ds__extract_quarter + , subq_6.ds__extract_month + , subq_6.ds__extract_day + , subq_6.ds__extract_dow + , subq_6.ds__extract_doy + , subq_6.created_at__day + , subq_6.created_at__week + , subq_6.created_at__month + , subq_6.created_at__quarter + , subq_6.created_at__year + , subq_6.created_at__extract_year + , subq_6.created_at__extract_quarter + , subq_6.created_at__extract_month + , subq_6.created_at__extract_day + , subq_6.created_at__extract_dow + , subq_6.created_at__extract_doy + , subq_6.ds_partitioned__day + , subq_6.ds_partitioned__week + , subq_6.ds_partitioned__month + , subq_6.ds_partitioned__quarter + , subq_6.ds_partitioned__year + , subq_6.ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy + , subq_6.last_profile_edit_ts__millisecond + , subq_6.last_profile_edit_ts__second + , subq_6.last_profile_edit_ts__minute + , subq_6.last_profile_edit_ts__hour + , subq_6.last_profile_edit_ts__day + , subq_6.last_profile_edit_ts__week + , subq_6.last_profile_edit_ts__month + , subq_6.last_profile_edit_ts__quarter + , subq_6.last_profile_edit_ts__year + , subq_6.last_profile_edit_ts__extract_year + , subq_6.last_profile_edit_ts__extract_quarter + , subq_6.last_profile_edit_ts__extract_month + , subq_6.last_profile_edit_ts__extract_day + , subq_6.last_profile_edit_ts__extract_dow + , subq_6.last_profile_edit_ts__extract_doy + , subq_6.bio_added_ts__second + , subq_6.bio_added_ts__minute + , subq_6.bio_added_ts__hour + , subq_6.bio_added_ts__day + , subq_6.bio_added_ts__week + , subq_6.bio_added_ts__month + , subq_6.bio_added_ts__quarter + , subq_6.bio_added_ts__year + , subq_6.bio_added_ts__extract_year + , subq_6.bio_added_ts__extract_quarter + , subq_6.bio_added_ts__extract_month + , subq_6.bio_added_ts__extract_day + , subq_6.bio_added_ts__extract_dow + , subq_6.bio_added_ts__extract_doy + , subq_6.last_login_ts__minute + , subq_6.last_login_ts__hour + , subq_6.last_login_ts__day + , subq_6.last_login_ts__week + , subq_6.last_login_ts__month + , subq_6.last_login_ts__quarter + , subq_6.last_login_ts__year + , subq_6.last_login_ts__extract_year + , subq_6.last_login_ts__extract_quarter + , subq_6.last_login_ts__extract_month + , subq_6.last_login_ts__extract_day + , subq_6.last_login_ts__extract_dow + , subq_6.last_login_ts__extract_doy + , subq_6.archived_at__hour + , subq_6.archived_at__day + , subq_6.archived_at__week + , subq_6.archived_at__month + , subq_6.archived_at__quarter + , subq_6.archived_at__year + , subq_6.archived_at__extract_year + , subq_6.archived_at__extract_quarter + , subq_6.archived_at__extract_month + , subq_6.archived_at__extract_day + , subq_6.archived_at__extract_dow + , subq_6.archived_at__extract_doy + , subq_6.user__ds__day + , subq_6.user__ds__week + , subq_6.user__ds__month + , subq_6.user__ds__quarter + , subq_6.user__ds__year + , subq_6.user__ds__extract_year + , subq_6.user__ds__extract_quarter + , subq_6.user__ds__extract_month + , subq_6.user__ds__extract_day + , subq_6.user__ds__extract_dow + , subq_6.user__ds__extract_doy + , subq_6.user__created_at__day + , subq_6.user__created_at__week + , subq_6.user__created_at__month + , subq_6.user__created_at__quarter + , subq_6.user__created_at__year + , subq_6.user__created_at__extract_year + , subq_6.user__created_at__extract_quarter + , subq_6.user__created_at__extract_month + , subq_6.user__created_at__extract_day + , subq_6.user__created_at__extract_dow + , subq_6.user__created_at__extract_doy + , subq_6.user__ds_partitioned__day + , subq_6.user__ds_partitioned__week + , subq_6.user__ds_partitioned__month + , subq_6.user__ds_partitioned__quarter + , subq_6.user__ds_partitioned__year + , subq_6.user__ds_partitioned__extract_year + , subq_6.user__ds_partitioned__extract_quarter + , subq_6.user__ds_partitioned__extract_month + , subq_6.user__ds_partitioned__extract_day + , subq_6.user__ds_partitioned__extract_dow + , subq_6.user__ds_partitioned__extract_doy + , subq_6.user__last_profile_edit_ts__millisecond + , subq_6.user__last_profile_edit_ts__second + , subq_6.user__last_profile_edit_ts__minute + , subq_6.user__last_profile_edit_ts__hour + , subq_6.user__last_profile_edit_ts__day + , subq_6.user__last_profile_edit_ts__week + , subq_6.user__last_profile_edit_ts__month + , subq_6.user__last_profile_edit_ts__quarter + , subq_6.user__last_profile_edit_ts__year + , subq_6.user__last_profile_edit_ts__extract_year + , subq_6.user__last_profile_edit_ts__extract_quarter + , subq_6.user__last_profile_edit_ts__extract_month + , subq_6.user__last_profile_edit_ts__extract_day + , subq_6.user__last_profile_edit_ts__extract_dow + , subq_6.user__last_profile_edit_ts__extract_doy + , subq_6.user__bio_added_ts__second + , subq_6.user__bio_added_ts__minute + , subq_6.user__bio_added_ts__hour + , subq_6.user__bio_added_ts__day + , subq_6.user__bio_added_ts__week + , subq_6.user__bio_added_ts__month + , subq_6.user__bio_added_ts__quarter + , subq_6.user__bio_added_ts__year + , subq_6.user__bio_added_ts__extract_year + , subq_6.user__bio_added_ts__extract_quarter + , subq_6.user__bio_added_ts__extract_month + , subq_6.user__bio_added_ts__extract_day + , subq_6.user__bio_added_ts__extract_dow + , subq_6.user__bio_added_ts__extract_doy + , subq_6.user__last_login_ts__minute + , subq_6.user__last_login_ts__hour + , subq_6.user__last_login_ts__day + , subq_6.user__last_login_ts__week + , subq_6.user__last_login_ts__month + , subq_6.user__last_login_ts__quarter + , subq_6.user__last_login_ts__year + , subq_6.user__last_login_ts__extract_year + , subq_6.user__last_login_ts__extract_quarter + , subq_6.user__last_login_ts__extract_month + , subq_6.user__last_login_ts__extract_day + , subq_6.user__last_login_ts__extract_dow + , subq_6.user__last_login_ts__extract_doy + , subq_6.user__archived_at__hour + , subq_6.user__archived_at__day + , subq_6.user__archived_at__week + , subq_6.user__archived_at__month + , subq_6.user__archived_at__quarter + , subq_6.user__archived_at__year + , subq_6.user__archived_at__extract_year + , subq_6.user__archived_at__extract_quarter + , subq_6.user__archived_at__extract_month + , subq_6.user__archived_at__extract_day + , subq_6.user__archived_at__extract_dow + , subq_6.user__archived_at__extract_doy + , subq_6.metric_time__day + , subq_6.metric_time__week + , subq_6.metric_time__month + , subq_6.metric_time__quarter + , subq_6.metric_time__year + , subq_6.metric_time__extract_year + , subq_6.metric_time__extract_quarter + , subq_6.metric_time__extract_month + , subq_6.metric_time__extract_day + , subq_6.metric_time__extract_dow + , subq_6.metric_time__extract_doy + , subq_6.user + , subq_6.home_state + , subq_6.user__home_state + FROM ( + -- Metric Time Dimension 'created_at' + SELECT + subq_5.ds__day + , subq_5.ds__week + , subq_5.ds__month + , subq_5.ds__quarter + , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_day + , subq_5.ds__extract_dow + , subq_5.ds__extract_doy + , subq_5.created_at__day + , subq_5.created_at__week + , subq_5.created_at__month + , subq_5.created_at__quarter + , subq_5.created_at__year + , subq_5.created_at__extract_year + , subq_5.created_at__extract_quarter + , subq_5.created_at__extract_month + , subq_5.created_at__extract_day + , subq_5.created_at__extract_dow + , subq_5.created_at__extract_doy + , subq_5.ds_partitioned__day + , subq_5.ds_partitioned__week + , subq_5.ds_partitioned__month + , subq_5.ds_partitioned__quarter + , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dow + , subq_5.ds_partitioned__extract_doy + , subq_5.last_profile_edit_ts__millisecond + , subq_5.last_profile_edit_ts__second + , subq_5.last_profile_edit_ts__minute + , subq_5.last_profile_edit_ts__hour + , subq_5.last_profile_edit_ts__day + , subq_5.last_profile_edit_ts__week + , subq_5.last_profile_edit_ts__month + , subq_5.last_profile_edit_ts__quarter + , subq_5.last_profile_edit_ts__year + , subq_5.last_profile_edit_ts__extract_year + , subq_5.last_profile_edit_ts__extract_quarter + , subq_5.last_profile_edit_ts__extract_month + , subq_5.last_profile_edit_ts__extract_day + , subq_5.last_profile_edit_ts__extract_dow + , subq_5.last_profile_edit_ts__extract_doy + , subq_5.bio_added_ts__second + , subq_5.bio_added_ts__minute + , subq_5.bio_added_ts__hour + , subq_5.bio_added_ts__day + , subq_5.bio_added_ts__week + , subq_5.bio_added_ts__month + , subq_5.bio_added_ts__quarter + , subq_5.bio_added_ts__year + , subq_5.bio_added_ts__extract_year + , subq_5.bio_added_ts__extract_quarter + , subq_5.bio_added_ts__extract_month + , subq_5.bio_added_ts__extract_day + , subq_5.bio_added_ts__extract_dow + , subq_5.bio_added_ts__extract_doy + , subq_5.last_login_ts__minute + , subq_5.last_login_ts__hour + , subq_5.last_login_ts__day + , subq_5.last_login_ts__week + , subq_5.last_login_ts__month + , subq_5.last_login_ts__quarter + , subq_5.last_login_ts__year + , subq_5.last_login_ts__extract_year + , subq_5.last_login_ts__extract_quarter + , subq_5.last_login_ts__extract_month + , subq_5.last_login_ts__extract_day + , subq_5.last_login_ts__extract_dow + , subq_5.last_login_ts__extract_doy + , subq_5.archived_at__hour + , subq_5.archived_at__day + , subq_5.archived_at__week + , subq_5.archived_at__month + , subq_5.archived_at__quarter + , subq_5.archived_at__year + , subq_5.archived_at__extract_year + , subq_5.archived_at__extract_quarter + , subq_5.archived_at__extract_month + , subq_5.archived_at__extract_day + , subq_5.archived_at__extract_dow + , subq_5.archived_at__extract_doy + , subq_5.user__ds__day + , subq_5.user__ds__week + , subq_5.user__ds__month + , subq_5.user__ds__quarter + , subq_5.user__ds__year + , subq_5.user__ds__extract_year + , subq_5.user__ds__extract_quarter + , subq_5.user__ds__extract_month + , subq_5.user__ds__extract_day + , subq_5.user__ds__extract_dow + , subq_5.user__ds__extract_doy + , subq_5.user__created_at__day + , subq_5.user__created_at__week + , subq_5.user__created_at__month + , subq_5.user__created_at__quarter + , subq_5.user__created_at__year + , subq_5.user__created_at__extract_year + , subq_5.user__created_at__extract_quarter + , subq_5.user__created_at__extract_month + , subq_5.user__created_at__extract_day + , subq_5.user__created_at__extract_dow + , subq_5.user__created_at__extract_doy + , subq_5.user__ds_partitioned__day + , subq_5.user__ds_partitioned__week + , subq_5.user__ds_partitioned__month + , subq_5.user__ds_partitioned__quarter + , subq_5.user__ds_partitioned__year + , subq_5.user__ds_partitioned__extract_year + , subq_5.user__ds_partitioned__extract_quarter + , subq_5.user__ds_partitioned__extract_month + , subq_5.user__ds_partitioned__extract_day + , subq_5.user__ds_partitioned__extract_dow + , subq_5.user__ds_partitioned__extract_doy + , subq_5.user__last_profile_edit_ts__millisecond + , subq_5.user__last_profile_edit_ts__second + , subq_5.user__last_profile_edit_ts__minute + , subq_5.user__last_profile_edit_ts__hour + , subq_5.user__last_profile_edit_ts__day + , subq_5.user__last_profile_edit_ts__week + , subq_5.user__last_profile_edit_ts__month + , subq_5.user__last_profile_edit_ts__quarter + , subq_5.user__last_profile_edit_ts__year + , subq_5.user__last_profile_edit_ts__extract_year + , subq_5.user__last_profile_edit_ts__extract_quarter + , subq_5.user__last_profile_edit_ts__extract_month + , subq_5.user__last_profile_edit_ts__extract_day + , subq_5.user__last_profile_edit_ts__extract_dow + , subq_5.user__last_profile_edit_ts__extract_doy + , subq_5.user__bio_added_ts__second + , subq_5.user__bio_added_ts__minute + , subq_5.user__bio_added_ts__hour + , subq_5.user__bio_added_ts__day + , subq_5.user__bio_added_ts__week + , subq_5.user__bio_added_ts__month + , subq_5.user__bio_added_ts__quarter + , subq_5.user__bio_added_ts__year + , subq_5.user__bio_added_ts__extract_year + , subq_5.user__bio_added_ts__extract_quarter + , subq_5.user__bio_added_ts__extract_month + , subq_5.user__bio_added_ts__extract_day + , subq_5.user__bio_added_ts__extract_dow + , subq_5.user__bio_added_ts__extract_doy + , subq_5.user__last_login_ts__minute + , subq_5.user__last_login_ts__hour + , subq_5.user__last_login_ts__day + , subq_5.user__last_login_ts__week + , subq_5.user__last_login_ts__month + , subq_5.user__last_login_ts__quarter + , subq_5.user__last_login_ts__year + , subq_5.user__last_login_ts__extract_year + , subq_5.user__last_login_ts__extract_quarter + , subq_5.user__last_login_ts__extract_month + , subq_5.user__last_login_ts__extract_day + , subq_5.user__last_login_ts__extract_dow + , subq_5.user__last_login_ts__extract_doy + , subq_5.user__archived_at__hour + , subq_5.user__archived_at__day + , subq_5.user__archived_at__week + , subq_5.user__archived_at__month + , subq_5.user__archived_at__quarter + , subq_5.user__archived_at__year + , subq_5.user__archived_at__extract_year + , subq_5.user__archived_at__extract_quarter + , subq_5.user__archived_at__extract_month + , subq_5.user__archived_at__extract_day + , subq_5.user__archived_at__extract_dow + , subq_5.user__archived_at__extract_doy + , subq_5.created_at__day AS metric_time__day + , subq_5.created_at__week AS metric_time__week + , subq_5.created_at__month AS metric_time__month + , subq_5.created_at__quarter AS metric_time__quarter + , subq_5.created_at__year AS metric_time__year + , subq_5.created_at__extract_year AS metric_time__extract_year + , subq_5.created_at__extract_quarter AS metric_time__extract_quarter + , subq_5.created_at__extract_month AS metric_time__extract_month + , subq_5.created_at__extract_day AS metric_time__extract_day + , subq_5.created_at__extract_dow AS metric_time__extract_dow + , subq_5.created_at__extract_doy AS metric_time__extract_doy + , subq_5.user + , subq_5.home_state + , subq_5.user__home_state + , subq_5.new_users + FROM ( + -- Read Elements From Semantic Model 'users_ds_source' + SELECT + 1 AS new_users + , 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.ds) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.created_at) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.created_at) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.archived_at) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.archived_at) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.archived_at) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.ds) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.created_at) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.created_at) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.archived_at) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.archived_at) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.archived_at) END 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_5 + ) subq_6 + ) subq_7 + ON + subq_4.user = subq_7.user + ) subq_8 + ) subq_9 + ON + ( + subq_2.listing = subq_9.listing + ) AND ( + subq_2.ds_partitioned__day = subq_9.user__ds_partitioned__day + ) + ) subq_10 + ) subq_11 + GROUP BY + subq_11.listing__user__bio_added_ts__minute +) subq_12 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql new file mode 100644 index 0000000000..d93a3918ba --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql @@ -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 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_metric_with_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_metric_with_sub_daily_dimension__plan0.sql new file mode 100644 index 0000000000..2fb720e755 --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_metric_with_sub_daily_dimension__plan0.sql @@ -0,0 +1,394 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.user__archived_at__hour + , subq_3.new_users +FROM ( + -- Aggregate Measures + SELECT + subq_2.user__archived_at__hour + , SUM(subq_2.new_users) AS new_users + FROM ( + -- Pass Only Elements: ['new_users', 'user__archived_at__hour'] + SELECT + subq_1.user__archived_at__hour + , subq_1.new_users + FROM ( + -- Metric Time Dimension 'created_at' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.created_at__day + , subq_0.created_at__week + , subq_0.created_at__month + , subq_0.created_at__quarter + , subq_0.created_at__year + , subq_0.created_at__extract_year + , subq_0.created_at__extract_quarter + , subq_0.created_at__extract_month + , subq_0.created_at__extract_day + , subq_0.created_at__extract_dow + , subq_0.created_at__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.last_profile_edit_ts__millisecond + , subq_0.last_profile_edit_ts__second + , subq_0.last_profile_edit_ts__minute + , subq_0.last_profile_edit_ts__hour + , subq_0.last_profile_edit_ts__day + , subq_0.last_profile_edit_ts__week + , subq_0.last_profile_edit_ts__month + , subq_0.last_profile_edit_ts__quarter + , subq_0.last_profile_edit_ts__year + , subq_0.last_profile_edit_ts__extract_year + , subq_0.last_profile_edit_ts__extract_quarter + , subq_0.last_profile_edit_ts__extract_month + , subq_0.last_profile_edit_ts__extract_day + , subq_0.last_profile_edit_ts__extract_dow + , subq_0.last_profile_edit_ts__extract_doy + , subq_0.bio_added_ts__second + , subq_0.bio_added_ts__minute + , subq_0.bio_added_ts__hour + , subq_0.bio_added_ts__day + , subq_0.bio_added_ts__week + , subq_0.bio_added_ts__month + , subq_0.bio_added_ts__quarter + , subq_0.bio_added_ts__year + , subq_0.bio_added_ts__extract_year + , subq_0.bio_added_ts__extract_quarter + , subq_0.bio_added_ts__extract_month + , subq_0.bio_added_ts__extract_day + , subq_0.bio_added_ts__extract_dow + , subq_0.bio_added_ts__extract_doy + , subq_0.last_login_ts__minute + , subq_0.last_login_ts__hour + , subq_0.last_login_ts__day + , subq_0.last_login_ts__week + , subq_0.last_login_ts__month + , subq_0.last_login_ts__quarter + , subq_0.last_login_ts__year + , subq_0.last_login_ts__extract_year + , subq_0.last_login_ts__extract_quarter + , subq_0.last_login_ts__extract_month + , subq_0.last_login_ts__extract_day + , subq_0.last_login_ts__extract_dow + , subq_0.last_login_ts__extract_doy + , subq_0.archived_at__hour + , subq_0.archived_at__day + , subq_0.archived_at__week + , subq_0.archived_at__month + , subq_0.archived_at__quarter + , subq_0.archived_at__year + , subq_0.archived_at__extract_year + , subq_0.archived_at__extract_quarter + , subq_0.archived_at__extract_month + , subq_0.archived_at__extract_day + , subq_0.archived_at__extract_dow + , subq_0.archived_at__extract_doy + , subq_0.user__ds__day + , subq_0.user__ds__week + , subq_0.user__ds__month + , subq_0.user__ds__quarter + , subq_0.user__ds__year + , subq_0.user__ds__extract_year + , subq_0.user__ds__extract_quarter + , subq_0.user__ds__extract_month + , subq_0.user__ds__extract_day + , subq_0.user__ds__extract_dow + , subq_0.user__ds__extract_doy + , subq_0.user__created_at__day + , subq_0.user__created_at__week + , subq_0.user__created_at__month + , subq_0.user__created_at__quarter + , subq_0.user__created_at__year + , subq_0.user__created_at__extract_year + , subq_0.user__created_at__extract_quarter + , subq_0.user__created_at__extract_month + , subq_0.user__created_at__extract_day + , subq_0.user__created_at__extract_dow + , subq_0.user__created_at__extract_doy + , subq_0.user__ds_partitioned__day + , subq_0.user__ds_partitioned__week + , subq_0.user__ds_partitioned__month + , subq_0.user__ds_partitioned__quarter + , subq_0.user__ds_partitioned__year + , subq_0.user__ds_partitioned__extract_year + , subq_0.user__ds_partitioned__extract_quarter + , subq_0.user__ds_partitioned__extract_month + , subq_0.user__ds_partitioned__extract_day + , subq_0.user__ds_partitioned__extract_dow + , subq_0.user__ds_partitioned__extract_doy + , subq_0.user__last_profile_edit_ts__millisecond + , subq_0.user__last_profile_edit_ts__second + , subq_0.user__last_profile_edit_ts__minute + , subq_0.user__last_profile_edit_ts__hour + , subq_0.user__last_profile_edit_ts__day + , subq_0.user__last_profile_edit_ts__week + , subq_0.user__last_profile_edit_ts__month + , subq_0.user__last_profile_edit_ts__quarter + , subq_0.user__last_profile_edit_ts__year + , subq_0.user__last_profile_edit_ts__extract_year + , subq_0.user__last_profile_edit_ts__extract_quarter + , subq_0.user__last_profile_edit_ts__extract_month + , subq_0.user__last_profile_edit_ts__extract_day + , subq_0.user__last_profile_edit_ts__extract_dow + , subq_0.user__last_profile_edit_ts__extract_doy + , subq_0.user__bio_added_ts__second + , subq_0.user__bio_added_ts__minute + , subq_0.user__bio_added_ts__hour + , subq_0.user__bio_added_ts__day + , subq_0.user__bio_added_ts__week + , subq_0.user__bio_added_ts__month + , subq_0.user__bio_added_ts__quarter + , subq_0.user__bio_added_ts__year + , subq_0.user__bio_added_ts__extract_year + , subq_0.user__bio_added_ts__extract_quarter + , subq_0.user__bio_added_ts__extract_month + , subq_0.user__bio_added_ts__extract_day + , subq_0.user__bio_added_ts__extract_dow + , subq_0.user__bio_added_ts__extract_doy + , subq_0.user__last_login_ts__minute + , subq_0.user__last_login_ts__hour + , subq_0.user__last_login_ts__day + , subq_0.user__last_login_ts__week + , subq_0.user__last_login_ts__month + , subq_0.user__last_login_ts__quarter + , subq_0.user__last_login_ts__year + , subq_0.user__last_login_ts__extract_year + , subq_0.user__last_login_ts__extract_quarter + , subq_0.user__last_login_ts__extract_month + , subq_0.user__last_login_ts__extract_day + , subq_0.user__last_login_ts__extract_dow + , subq_0.user__last_login_ts__extract_doy + , subq_0.user__archived_at__hour + , subq_0.user__archived_at__day + , subq_0.user__archived_at__week + , subq_0.user__archived_at__month + , subq_0.user__archived_at__quarter + , subq_0.user__archived_at__year + , subq_0.user__archived_at__extract_year + , subq_0.user__archived_at__extract_quarter + , subq_0.user__archived_at__extract_month + , subq_0.user__archived_at__extract_day + , subq_0.user__archived_at__extract_dow + , subq_0.user__archived_at__extract_doy + , subq_0.created_at__day AS metric_time__day + , subq_0.created_at__week AS metric_time__week + , subq_0.created_at__month AS metric_time__month + , subq_0.created_at__quarter AS metric_time__quarter + , subq_0.created_at__year AS metric_time__year + , subq_0.created_at__extract_year AS metric_time__extract_year + , subq_0.created_at__extract_quarter AS metric_time__extract_quarter + , subq_0.created_at__extract_month AS metric_time__extract_month + , subq_0.created_at__extract_day AS metric_time__extract_day + , subq_0.created_at__extract_dow AS metric_time__extract_dow + , subq_0.created_at__extract_doy AS metric_time__extract_doy + , subq_0.user + , subq_0.home_state + , subq_0.user__home_state + , subq_0.new_users + FROM ( + -- Read Elements From Semantic Model 'users_ds_source' + SELECT + 1 AS new_users + , 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.ds) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.created_at) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.created_at) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.archived_at) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.archived_at) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.archived_at) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.ds) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.created_at) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.created_at) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.ds_partitioned) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.last_profile_edit_ts) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.bio_added_ts) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.last_login_ts) END 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 + , CASE WHEN EXTRACT(dow FROM users_ds_source_src_28000.archived_at) = 0 THEN EXTRACT(dow FROM users_ds_source_src_28000.archived_at) + 7 ELSE EXTRACT(dow FROM users_ds_source_src_28000.archived_at) END 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 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.user__archived_at__hour +) subq_3 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql new file mode 100644 index 0000000000..c20146c881 --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql @@ -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 + DATE_TRUNC('hour', archived_at) 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 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql new file mode 100644 index 0000000000..86a9dc583b --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql @@ -0,0 +1,1303 @@ +-- Compute Metrics via Expressions +SELECT + subq_12.listing__user__bio_added_ts__minute + , subq_12.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_11.listing__user__bio_added_ts__minute + , SUM(subq_11.bookings) AS bookings + FROM ( + -- Pass Only Elements: ['bookings', 'listing__user__bio_added_ts__minute'] + SELECT + subq_10.listing__user__bio_added_ts__minute + , subq_10.bookings + FROM ( + -- Join Standard Outputs + SELECT + subq_2.ds_partitioned__day AS ds_partitioned__day + , subq_9.user__ds_partitioned__day AS listing__user__ds_partitioned__day + , subq_9.user__bio_added_ts__minute AS listing__user__bio_added_ts__minute + , subq_2.listing AS listing + , subq_2.bookings AS bookings + FROM ( + -- Pass Only Elements: ['bookings', 'ds_partitioned__day', 'listing'] + SELECT + subq_1.ds_partitioned__day + , subq_1.listing + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_28000.booking_value + , bookings_source_src_28000.booking_value AS max_booking_value + , bookings_source_src_28000.booking_value AS min_booking_value + , bookings_source_src_28000.guest_id AS bookers + , bookings_source_src_28000.booking_value AS average_booking_value + , bookings_source_src_28000.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_28000.booking_value AS median_booking_value + , bookings_source_src_28000.booking_value AS booking_value_p99 + , bookings_source_src_28000.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28000.is_instant + , DATE_TRUNC('day', bookings_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy + , bookings_source_src_28000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day + , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28000.listing_id AS listing + , bookings_source_src_28000.guest_id AS guest + , bookings_source_src_28000.host_id AS host + , bookings_source_src_28000.listing_id AS booking__listing + , bookings_source_src_28000.guest_id AS booking__guest + , bookings_source_src_28000.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28000 + ) subq_0 + ) subq_1 + ) subq_2 + LEFT OUTER JOIN ( + -- Pass Only Elements: ['user__ds_partitioned__day', 'user__bio_added_ts__minute', 'listing'] + SELECT + subq_8.user__ds_partitioned__day + , subq_8.user__bio_added_ts__minute + , subq_8.listing + FROM ( + -- Join Standard Outputs + SELECT + subq_4.ds__day AS ds__day + , subq_4.ds__week AS ds__week + , subq_4.ds__month AS ds__month + , subq_4.ds__quarter AS ds__quarter + , subq_4.ds__year AS ds__year + , subq_4.ds__extract_year AS ds__extract_year + , subq_4.ds__extract_quarter AS ds__extract_quarter + , subq_4.ds__extract_month AS ds__extract_month + , subq_4.ds__extract_day AS ds__extract_day + , subq_4.ds__extract_dow AS ds__extract_dow + , subq_4.ds__extract_doy AS ds__extract_doy + , subq_4.created_at__day AS created_at__day + , subq_4.created_at__week AS created_at__week + , subq_4.created_at__month AS created_at__month + , subq_4.created_at__quarter AS created_at__quarter + , subq_4.created_at__year AS created_at__year + , subq_4.created_at__extract_year AS created_at__extract_year + , subq_4.created_at__extract_quarter AS created_at__extract_quarter + , subq_4.created_at__extract_month AS created_at__extract_month + , subq_4.created_at__extract_day AS created_at__extract_day + , subq_4.created_at__extract_dow AS created_at__extract_dow + , subq_4.created_at__extract_doy AS created_at__extract_doy + , subq_4.listing__ds__day AS listing__ds__day + , subq_4.listing__ds__week AS listing__ds__week + , subq_4.listing__ds__month AS listing__ds__month + , subq_4.listing__ds__quarter AS listing__ds__quarter + , subq_4.listing__ds__year AS listing__ds__year + , subq_4.listing__ds__extract_year AS listing__ds__extract_year + , subq_4.listing__ds__extract_quarter AS listing__ds__extract_quarter + , subq_4.listing__ds__extract_month AS listing__ds__extract_month + , subq_4.listing__ds__extract_day AS listing__ds__extract_day + , subq_4.listing__ds__extract_dow AS listing__ds__extract_dow + , subq_4.listing__ds__extract_doy AS listing__ds__extract_doy + , subq_4.listing__created_at__day AS listing__created_at__day + , subq_4.listing__created_at__week AS listing__created_at__week + , subq_4.listing__created_at__month AS listing__created_at__month + , subq_4.listing__created_at__quarter AS listing__created_at__quarter + , subq_4.listing__created_at__year AS listing__created_at__year + , subq_4.listing__created_at__extract_year AS listing__created_at__extract_year + , subq_4.listing__created_at__extract_quarter AS listing__created_at__extract_quarter + , subq_4.listing__created_at__extract_month AS listing__created_at__extract_month + , subq_4.listing__created_at__extract_day AS listing__created_at__extract_day + , subq_4.listing__created_at__extract_dow AS listing__created_at__extract_dow + , subq_4.listing__created_at__extract_doy AS listing__created_at__extract_doy + , subq_4.metric_time__day AS metric_time__day + , 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_7.ds__day AS user__ds__day + , subq_7.ds__week AS user__ds__week + , subq_7.ds__month AS user__ds__month + , subq_7.ds__quarter AS user__ds__quarter + , subq_7.ds__year AS user__ds__year + , subq_7.ds__extract_year AS user__ds__extract_year + , subq_7.ds__extract_quarter AS user__ds__extract_quarter + , subq_7.ds__extract_month AS user__ds__extract_month + , subq_7.ds__extract_day AS user__ds__extract_day + , subq_7.ds__extract_dow AS user__ds__extract_dow + , subq_7.ds__extract_doy AS user__ds__extract_doy + , subq_7.created_at__day AS user__created_at__day + , subq_7.created_at__week AS user__created_at__week + , subq_7.created_at__month AS user__created_at__month + , subq_7.created_at__quarter AS user__created_at__quarter + , subq_7.created_at__year AS user__created_at__year + , subq_7.created_at__extract_year AS user__created_at__extract_year + , subq_7.created_at__extract_quarter AS user__created_at__extract_quarter + , subq_7.created_at__extract_month AS user__created_at__extract_month + , subq_7.created_at__extract_day AS user__created_at__extract_day + , subq_7.created_at__extract_dow AS user__created_at__extract_dow + , subq_7.created_at__extract_doy AS user__created_at__extract_doy + , subq_7.ds_partitioned__day AS user__ds_partitioned__day + , subq_7.ds_partitioned__week AS user__ds_partitioned__week + , subq_7.ds_partitioned__month AS user__ds_partitioned__month + , subq_7.ds_partitioned__quarter AS user__ds_partitioned__quarter + , subq_7.ds_partitioned__year AS user__ds_partitioned__year + , subq_7.ds_partitioned__extract_year AS user__ds_partitioned__extract_year + , subq_7.ds_partitioned__extract_quarter AS user__ds_partitioned__extract_quarter + , subq_7.ds_partitioned__extract_month AS user__ds_partitioned__extract_month + , subq_7.ds_partitioned__extract_day AS user__ds_partitioned__extract_day + , subq_7.ds_partitioned__extract_dow AS user__ds_partitioned__extract_dow + , subq_7.ds_partitioned__extract_doy AS user__ds_partitioned__extract_doy + , subq_7.last_profile_edit_ts__millisecond AS user__last_profile_edit_ts__millisecond + , subq_7.last_profile_edit_ts__second AS user__last_profile_edit_ts__second + , subq_7.last_profile_edit_ts__minute AS user__last_profile_edit_ts__minute + , subq_7.last_profile_edit_ts__hour AS user__last_profile_edit_ts__hour + , subq_7.last_profile_edit_ts__day AS user__last_profile_edit_ts__day + , subq_7.last_profile_edit_ts__week AS user__last_profile_edit_ts__week + , subq_7.last_profile_edit_ts__month AS user__last_profile_edit_ts__month + , subq_7.last_profile_edit_ts__quarter AS user__last_profile_edit_ts__quarter + , subq_7.last_profile_edit_ts__year AS user__last_profile_edit_ts__year + , subq_7.last_profile_edit_ts__extract_year AS user__last_profile_edit_ts__extract_year + , subq_7.last_profile_edit_ts__extract_quarter AS user__last_profile_edit_ts__extract_quarter + , subq_7.last_profile_edit_ts__extract_month AS user__last_profile_edit_ts__extract_month + , subq_7.last_profile_edit_ts__extract_day AS user__last_profile_edit_ts__extract_day + , subq_7.last_profile_edit_ts__extract_dow AS user__last_profile_edit_ts__extract_dow + , subq_7.last_profile_edit_ts__extract_doy AS user__last_profile_edit_ts__extract_doy + , subq_7.bio_added_ts__second AS user__bio_added_ts__second + , subq_7.bio_added_ts__minute AS user__bio_added_ts__minute + , subq_7.bio_added_ts__hour AS user__bio_added_ts__hour + , subq_7.bio_added_ts__day AS user__bio_added_ts__day + , subq_7.bio_added_ts__week AS user__bio_added_ts__week + , subq_7.bio_added_ts__month AS user__bio_added_ts__month + , subq_7.bio_added_ts__quarter AS user__bio_added_ts__quarter + , subq_7.bio_added_ts__year AS user__bio_added_ts__year + , subq_7.bio_added_ts__extract_year AS user__bio_added_ts__extract_year + , subq_7.bio_added_ts__extract_quarter AS user__bio_added_ts__extract_quarter + , subq_7.bio_added_ts__extract_month AS user__bio_added_ts__extract_month + , subq_7.bio_added_ts__extract_day AS user__bio_added_ts__extract_day + , subq_7.bio_added_ts__extract_dow AS user__bio_added_ts__extract_dow + , subq_7.bio_added_ts__extract_doy AS user__bio_added_ts__extract_doy + , subq_7.last_login_ts__minute AS user__last_login_ts__minute + , subq_7.last_login_ts__hour AS user__last_login_ts__hour + , subq_7.last_login_ts__day AS user__last_login_ts__day + , subq_7.last_login_ts__week AS user__last_login_ts__week + , subq_7.last_login_ts__month AS user__last_login_ts__month + , subq_7.last_login_ts__quarter AS user__last_login_ts__quarter + , subq_7.last_login_ts__year AS user__last_login_ts__year + , subq_7.last_login_ts__extract_year AS user__last_login_ts__extract_year + , subq_7.last_login_ts__extract_quarter AS user__last_login_ts__extract_quarter + , subq_7.last_login_ts__extract_month AS user__last_login_ts__extract_month + , subq_7.last_login_ts__extract_day AS user__last_login_ts__extract_day + , subq_7.last_login_ts__extract_dow AS user__last_login_ts__extract_dow + , subq_7.last_login_ts__extract_doy AS user__last_login_ts__extract_doy + , subq_7.archived_at__hour AS user__archived_at__hour + , subq_7.archived_at__day AS user__archived_at__day + , subq_7.archived_at__week AS user__archived_at__week + , subq_7.archived_at__month AS user__archived_at__month + , subq_7.archived_at__quarter AS user__archived_at__quarter + , subq_7.archived_at__year AS user__archived_at__year + , subq_7.archived_at__extract_year AS user__archived_at__extract_year + , subq_7.archived_at__extract_quarter AS user__archived_at__extract_quarter + , subq_7.archived_at__extract_month AS user__archived_at__extract_month + , subq_7.archived_at__extract_day AS user__archived_at__extract_day + , subq_7.archived_at__extract_dow AS user__archived_at__extract_dow + , subq_7.archived_at__extract_doy AS user__archived_at__extract_doy + , subq_7.metric_time__day AS user__metric_time__day + , subq_7.metric_time__week AS user__metric_time__week + , subq_7.metric_time__month AS user__metric_time__month + , subq_7.metric_time__quarter AS user__metric_time__quarter + , subq_7.metric_time__year AS user__metric_time__year + , subq_7.metric_time__extract_year AS user__metric_time__extract_year + , subq_7.metric_time__extract_quarter AS user__metric_time__extract_quarter + , subq_7.metric_time__extract_month AS user__metric_time__extract_month + , subq_7.metric_time__extract_day AS user__metric_time__extract_day + , subq_7.metric_time__extract_dow AS user__metric_time__extract_dow + , subq_7.metric_time__extract_doy AS user__metric_time__extract_doy + , subq_4.listing AS listing + , subq_4.user AS user + , subq_4.listing__user AS listing__user + , subq_4.country_latest AS country_latest + , subq_4.is_lux_latest AS is_lux_latest + , subq_4.capacity_latest AS capacity_latest + , subq_4.listing__country_latest AS listing__country_latest + , subq_4.listing__is_lux_latest AS listing__is_lux_latest + , subq_4.listing__capacity_latest AS listing__capacity_latest + , subq_7.home_state AS user__home_state + , subq_4.listings AS listings + , subq_4.largest_listing AS largest_listing + , subq_4.smallest_listing AS smallest_listing + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_3.ds__day + , subq_3.ds__week + , subq_3.ds__month + , subq_3.ds__quarter + , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_day + , subq_3.ds__extract_dow + , subq_3.ds__extract_doy + , subq_3.created_at__day + , subq_3.created_at__week + , subq_3.created_at__month + , subq_3.created_at__quarter + , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy + , subq_3.listing__ds__day + , subq_3.listing__ds__week + , subq_3.listing__ds__month + , subq_3.listing__ds__quarter + , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dow + , subq_3.listing__ds__extract_doy + , subq_3.listing__created_at__day + , subq_3.listing__created_at__week + , subq_3.listing__created_at__month + , subq_3.listing__created_at__quarter + , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dow + , subq_3.listing__created_at__extract_doy + , subq_3.ds__day AS metric_time__day + , subq_3.ds__week AS metric_time__week + , subq_3.ds__month AS metric_time__month + , subq_3.ds__quarter AS metric_time__quarter + , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy + , subq_3.listing + , subq_3.user + , subq_3.listing__user + , subq_3.country_latest + , subq_3.is_lux_latest + , subq_3.capacity_latest + , subq_3.listing__country_latest + , subq_3.listing__is_lux_latest + , subq_3.listing__capacity_latest + , subq_3.listings + , subq_3.largest_listing + , subq_3.smallest_listing + FROM ( + -- Read Elements From Semantic Model 'listings_latest' + SELECT + 1 AS listings + , listings_latest_src_28000.capacity AS largest_listing + , listings_latest_src_28000.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS created_at__extract_dow + , EXTRACT(doy 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 + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy 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 + FROM ***************************.dim_listings_latest listings_latest_src_28000 + ) subq_3 + ) subq_4 + LEFT OUTER JOIN ( + -- Pass Only Elements: [ + -- 'home_state', + -- 'user__home_state', + -- 'ds__day', + -- 'ds__week', + -- 'ds__month', + -- 'ds__quarter', + -- 'ds__year', + -- 'ds__extract_year', + -- 'ds__extract_quarter', + -- 'ds__extract_month', + -- 'ds__extract_day', + -- 'ds__extract_dow', + -- 'ds__extract_doy', + -- 'created_at__day', + -- 'created_at__week', + -- 'created_at__month', + -- 'created_at__quarter', + -- 'created_at__year', + -- 'created_at__extract_year', + -- 'created_at__extract_quarter', + -- 'created_at__extract_month', + -- 'created_at__extract_day', + -- 'created_at__extract_dow', + -- 'created_at__extract_doy', + -- 'ds_partitioned__day', + -- 'ds_partitioned__week', + -- 'ds_partitioned__month', + -- 'ds_partitioned__quarter', + -- 'ds_partitioned__year', + -- 'ds_partitioned__extract_year', + -- 'ds_partitioned__extract_quarter', + -- 'ds_partitioned__extract_month', + -- 'ds_partitioned__extract_day', + -- 'ds_partitioned__extract_dow', + -- 'ds_partitioned__extract_doy', + -- 'last_profile_edit_ts__millisecond', + -- 'last_profile_edit_ts__second', + -- 'last_profile_edit_ts__minute', + -- 'last_profile_edit_ts__hour', + -- 'last_profile_edit_ts__day', + -- 'last_profile_edit_ts__week', + -- 'last_profile_edit_ts__month', + -- 'last_profile_edit_ts__quarter', + -- 'last_profile_edit_ts__year', + -- 'last_profile_edit_ts__extract_year', + -- 'last_profile_edit_ts__extract_quarter', + -- 'last_profile_edit_ts__extract_month', + -- 'last_profile_edit_ts__extract_day', + -- 'last_profile_edit_ts__extract_dow', + -- 'last_profile_edit_ts__extract_doy', + -- 'bio_added_ts__second', + -- 'bio_added_ts__minute', + -- 'bio_added_ts__hour', + -- 'bio_added_ts__day', + -- 'bio_added_ts__week', + -- 'bio_added_ts__month', + -- 'bio_added_ts__quarter', + -- 'bio_added_ts__year', + -- 'bio_added_ts__extract_year', + -- 'bio_added_ts__extract_quarter', + -- 'bio_added_ts__extract_month', + -- 'bio_added_ts__extract_day', + -- 'bio_added_ts__extract_dow', + -- 'bio_added_ts__extract_doy', + -- 'last_login_ts__minute', + -- 'last_login_ts__hour', + -- 'last_login_ts__day', + -- 'last_login_ts__week', + -- 'last_login_ts__month', + -- 'last_login_ts__quarter', + -- 'last_login_ts__year', + -- 'last_login_ts__extract_year', + -- 'last_login_ts__extract_quarter', + -- 'last_login_ts__extract_month', + -- 'last_login_ts__extract_day', + -- 'last_login_ts__extract_dow', + -- 'last_login_ts__extract_doy', + -- 'archived_at__hour', + -- 'archived_at__day', + -- 'archived_at__week', + -- 'archived_at__month', + -- 'archived_at__quarter', + -- 'archived_at__year', + -- 'archived_at__extract_year', + -- 'archived_at__extract_quarter', + -- 'archived_at__extract_month', + -- 'archived_at__extract_day', + -- 'archived_at__extract_dow', + -- 'archived_at__extract_doy', + -- 'user__ds__day', + -- 'user__ds__week', + -- 'user__ds__month', + -- 'user__ds__quarter', + -- 'user__ds__year', + -- 'user__ds__extract_year', + -- 'user__ds__extract_quarter', + -- 'user__ds__extract_month', + -- 'user__ds__extract_day', + -- 'user__ds__extract_dow', + -- 'user__ds__extract_doy', + -- 'user__created_at__day', + -- 'user__created_at__week', + -- 'user__created_at__month', + -- 'user__created_at__quarter', + -- 'user__created_at__year', + -- 'user__created_at__extract_year', + -- 'user__created_at__extract_quarter', + -- 'user__created_at__extract_month', + -- 'user__created_at__extract_day', + -- 'user__created_at__extract_dow', + -- 'user__created_at__extract_doy', + -- 'user__ds_partitioned__day', + -- 'user__ds_partitioned__week', + -- 'user__ds_partitioned__month', + -- 'user__ds_partitioned__quarter', + -- 'user__ds_partitioned__year', + -- 'user__ds_partitioned__extract_year', + -- 'user__ds_partitioned__extract_quarter', + -- 'user__ds_partitioned__extract_month', + -- 'user__ds_partitioned__extract_day', + -- 'user__ds_partitioned__extract_dow', + -- 'user__ds_partitioned__extract_doy', + -- 'user__last_profile_edit_ts__millisecond', + -- 'user__last_profile_edit_ts__second', + -- 'user__last_profile_edit_ts__minute', + -- 'user__last_profile_edit_ts__hour', + -- 'user__last_profile_edit_ts__day', + -- 'user__last_profile_edit_ts__week', + -- 'user__last_profile_edit_ts__month', + -- 'user__last_profile_edit_ts__quarter', + -- 'user__last_profile_edit_ts__year', + -- 'user__last_profile_edit_ts__extract_year', + -- 'user__last_profile_edit_ts__extract_quarter', + -- 'user__last_profile_edit_ts__extract_month', + -- 'user__last_profile_edit_ts__extract_day', + -- 'user__last_profile_edit_ts__extract_dow', + -- 'user__last_profile_edit_ts__extract_doy', + -- 'user__bio_added_ts__second', + -- 'user__bio_added_ts__minute', + -- 'user__bio_added_ts__hour', + -- 'user__bio_added_ts__day', + -- 'user__bio_added_ts__week', + -- 'user__bio_added_ts__month', + -- 'user__bio_added_ts__quarter', + -- 'user__bio_added_ts__year', + -- 'user__bio_added_ts__extract_year', + -- 'user__bio_added_ts__extract_quarter', + -- 'user__bio_added_ts__extract_month', + -- 'user__bio_added_ts__extract_day', + -- 'user__bio_added_ts__extract_dow', + -- 'user__bio_added_ts__extract_doy', + -- 'user__last_login_ts__minute', + -- 'user__last_login_ts__hour', + -- 'user__last_login_ts__day', + -- 'user__last_login_ts__week', + -- 'user__last_login_ts__month', + -- 'user__last_login_ts__quarter', + -- 'user__last_login_ts__year', + -- 'user__last_login_ts__extract_year', + -- 'user__last_login_ts__extract_quarter', + -- 'user__last_login_ts__extract_month', + -- 'user__last_login_ts__extract_day', + -- 'user__last_login_ts__extract_dow', + -- 'user__last_login_ts__extract_doy', + -- 'user__archived_at__hour', + -- 'user__archived_at__day', + -- 'user__archived_at__week', + -- 'user__archived_at__month', + -- 'user__archived_at__quarter', + -- 'user__archived_at__year', + -- 'user__archived_at__extract_year', + -- 'user__archived_at__extract_quarter', + -- 'user__archived_at__extract_month', + -- 'user__archived_at__extract_day', + -- 'user__archived_at__extract_dow', + -- 'user__archived_at__extract_doy', + -- 'metric_time__day', + -- 'metric_time__week', + -- 'metric_time__month', + -- 'metric_time__quarter', + -- 'metric_time__year', + -- 'metric_time__extract_year', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_month', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'user', + -- ] + SELECT + subq_6.ds__day + , subq_6.ds__week + , subq_6.ds__month + , subq_6.ds__quarter + , subq_6.ds__year + , subq_6.ds__extract_year + , subq_6.ds__extract_quarter + , subq_6.ds__extract_month + , subq_6.ds__extract_day + , subq_6.ds__extract_dow + , subq_6.ds__extract_doy + , subq_6.created_at__day + , subq_6.created_at__week + , subq_6.created_at__month + , subq_6.created_at__quarter + , subq_6.created_at__year + , subq_6.created_at__extract_year + , subq_6.created_at__extract_quarter + , subq_6.created_at__extract_month + , subq_6.created_at__extract_day + , subq_6.created_at__extract_dow + , subq_6.created_at__extract_doy + , subq_6.ds_partitioned__day + , subq_6.ds_partitioned__week + , subq_6.ds_partitioned__month + , subq_6.ds_partitioned__quarter + , subq_6.ds_partitioned__year + , subq_6.ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy + , subq_6.last_profile_edit_ts__millisecond + , subq_6.last_profile_edit_ts__second + , subq_6.last_profile_edit_ts__minute + , subq_6.last_profile_edit_ts__hour + , subq_6.last_profile_edit_ts__day + , subq_6.last_profile_edit_ts__week + , subq_6.last_profile_edit_ts__month + , subq_6.last_profile_edit_ts__quarter + , subq_6.last_profile_edit_ts__year + , subq_6.last_profile_edit_ts__extract_year + , subq_6.last_profile_edit_ts__extract_quarter + , subq_6.last_profile_edit_ts__extract_month + , subq_6.last_profile_edit_ts__extract_day + , subq_6.last_profile_edit_ts__extract_dow + , subq_6.last_profile_edit_ts__extract_doy + , subq_6.bio_added_ts__second + , subq_6.bio_added_ts__minute + , subq_6.bio_added_ts__hour + , subq_6.bio_added_ts__day + , subq_6.bio_added_ts__week + , subq_6.bio_added_ts__month + , subq_6.bio_added_ts__quarter + , subq_6.bio_added_ts__year + , subq_6.bio_added_ts__extract_year + , subq_6.bio_added_ts__extract_quarter + , subq_6.bio_added_ts__extract_month + , subq_6.bio_added_ts__extract_day + , subq_6.bio_added_ts__extract_dow + , subq_6.bio_added_ts__extract_doy + , subq_6.last_login_ts__minute + , subq_6.last_login_ts__hour + , subq_6.last_login_ts__day + , subq_6.last_login_ts__week + , subq_6.last_login_ts__month + , subq_6.last_login_ts__quarter + , subq_6.last_login_ts__year + , subq_6.last_login_ts__extract_year + , subq_6.last_login_ts__extract_quarter + , subq_6.last_login_ts__extract_month + , subq_6.last_login_ts__extract_day + , subq_6.last_login_ts__extract_dow + , subq_6.last_login_ts__extract_doy + , subq_6.archived_at__hour + , subq_6.archived_at__day + , subq_6.archived_at__week + , subq_6.archived_at__month + , subq_6.archived_at__quarter + , subq_6.archived_at__year + , subq_6.archived_at__extract_year + , subq_6.archived_at__extract_quarter + , subq_6.archived_at__extract_month + , subq_6.archived_at__extract_day + , subq_6.archived_at__extract_dow + , subq_6.archived_at__extract_doy + , subq_6.user__ds__day + , subq_6.user__ds__week + , subq_6.user__ds__month + , subq_6.user__ds__quarter + , subq_6.user__ds__year + , subq_6.user__ds__extract_year + , subq_6.user__ds__extract_quarter + , subq_6.user__ds__extract_month + , subq_6.user__ds__extract_day + , subq_6.user__ds__extract_dow + , subq_6.user__ds__extract_doy + , subq_6.user__created_at__day + , subq_6.user__created_at__week + , subq_6.user__created_at__month + , subq_6.user__created_at__quarter + , subq_6.user__created_at__year + , subq_6.user__created_at__extract_year + , subq_6.user__created_at__extract_quarter + , subq_6.user__created_at__extract_month + , subq_6.user__created_at__extract_day + , subq_6.user__created_at__extract_dow + , subq_6.user__created_at__extract_doy + , subq_6.user__ds_partitioned__day + , subq_6.user__ds_partitioned__week + , subq_6.user__ds_partitioned__month + , subq_6.user__ds_partitioned__quarter + , subq_6.user__ds_partitioned__year + , subq_6.user__ds_partitioned__extract_year + , subq_6.user__ds_partitioned__extract_quarter + , subq_6.user__ds_partitioned__extract_month + , subq_6.user__ds_partitioned__extract_day + , subq_6.user__ds_partitioned__extract_dow + , subq_6.user__ds_partitioned__extract_doy + , subq_6.user__last_profile_edit_ts__millisecond + , subq_6.user__last_profile_edit_ts__second + , subq_6.user__last_profile_edit_ts__minute + , subq_6.user__last_profile_edit_ts__hour + , subq_6.user__last_profile_edit_ts__day + , subq_6.user__last_profile_edit_ts__week + , subq_6.user__last_profile_edit_ts__month + , subq_6.user__last_profile_edit_ts__quarter + , subq_6.user__last_profile_edit_ts__year + , subq_6.user__last_profile_edit_ts__extract_year + , subq_6.user__last_profile_edit_ts__extract_quarter + , subq_6.user__last_profile_edit_ts__extract_month + , subq_6.user__last_profile_edit_ts__extract_day + , subq_6.user__last_profile_edit_ts__extract_dow + , subq_6.user__last_profile_edit_ts__extract_doy + , subq_6.user__bio_added_ts__second + , subq_6.user__bio_added_ts__minute + , subq_6.user__bio_added_ts__hour + , subq_6.user__bio_added_ts__day + , subq_6.user__bio_added_ts__week + , subq_6.user__bio_added_ts__month + , subq_6.user__bio_added_ts__quarter + , subq_6.user__bio_added_ts__year + , subq_6.user__bio_added_ts__extract_year + , subq_6.user__bio_added_ts__extract_quarter + , subq_6.user__bio_added_ts__extract_month + , subq_6.user__bio_added_ts__extract_day + , subq_6.user__bio_added_ts__extract_dow + , subq_6.user__bio_added_ts__extract_doy + , subq_6.user__last_login_ts__minute + , subq_6.user__last_login_ts__hour + , subq_6.user__last_login_ts__day + , subq_6.user__last_login_ts__week + , subq_6.user__last_login_ts__month + , subq_6.user__last_login_ts__quarter + , subq_6.user__last_login_ts__year + , subq_6.user__last_login_ts__extract_year + , subq_6.user__last_login_ts__extract_quarter + , subq_6.user__last_login_ts__extract_month + , subq_6.user__last_login_ts__extract_day + , subq_6.user__last_login_ts__extract_dow + , subq_6.user__last_login_ts__extract_doy + , subq_6.user__archived_at__hour + , subq_6.user__archived_at__day + , subq_6.user__archived_at__week + , subq_6.user__archived_at__month + , subq_6.user__archived_at__quarter + , subq_6.user__archived_at__year + , subq_6.user__archived_at__extract_year + , subq_6.user__archived_at__extract_quarter + , subq_6.user__archived_at__extract_month + , subq_6.user__archived_at__extract_day + , subq_6.user__archived_at__extract_dow + , subq_6.user__archived_at__extract_doy + , subq_6.metric_time__day + , subq_6.metric_time__week + , subq_6.metric_time__month + , subq_6.metric_time__quarter + , subq_6.metric_time__year + , subq_6.metric_time__extract_year + , subq_6.metric_time__extract_quarter + , subq_6.metric_time__extract_month + , subq_6.metric_time__extract_day + , subq_6.metric_time__extract_dow + , subq_6.metric_time__extract_doy + , subq_6.user + , subq_6.home_state + , subq_6.user__home_state + FROM ( + -- Metric Time Dimension 'created_at' + SELECT + subq_5.ds__day + , subq_5.ds__week + , subq_5.ds__month + , subq_5.ds__quarter + , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_day + , subq_5.ds__extract_dow + , subq_5.ds__extract_doy + , subq_5.created_at__day + , subq_5.created_at__week + , subq_5.created_at__month + , subq_5.created_at__quarter + , subq_5.created_at__year + , subq_5.created_at__extract_year + , subq_5.created_at__extract_quarter + , subq_5.created_at__extract_month + , subq_5.created_at__extract_day + , subq_5.created_at__extract_dow + , subq_5.created_at__extract_doy + , subq_5.ds_partitioned__day + , subq_5.ds_partitioned__week + , subq_5.ds_partitioned__month + , subq_5.ds_partitioned__quarter + , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dow + , subq_5.ds_partitioned__extract_doy + , subq_5.last_profile_edit_ts__millisecond + , subq_5.last_profile_edit_ts__second + , subq_5.last_profile_edit_ts__minute + , subq_5.last_profile_edit_ts__hour + , subq_5.last_profile_edit_ts__day + , subq_5.last_profile_edit_ts__week + , subq_5.last_profile_edit_ts__month + , subq_5.last_profile_edit_ts__quarter + , subq_5.last_profile_edit_ts__year + , subq_5.last_profile_edit_ts__extract_year + , subq_5.last_profile_edit_ts__extract_quarter + , subq_5.last_profile_edit_ts__extract_month + , subq_5.last_profile_edit_ts__extract_day + , subq_5.last_profile_edit_ts__extract_dow + , subq_5.last_profile_edit_ts__extract_doy + , subq_5.bio_added_ts__second + , subq_5.bio_added_ts__minute + , subq_5.bio_added_ts__hour + , subq_5.bio_added_ts__day + , subq_5.bio_added_ts__week + , subq_5.bio_added_ts__month + , subq_5.bio_added_ts__quarter + , subq_5.bio_added_ts__year + , subq_5.bio_added_ts__extract_year + , subq_5.bio_added_ts__extract_quarter + , subq_5.bio_added_ts__extract_month + , subq_5.bio_added_ts__extract_day + , subq_5.bio_added_ts__extract_dow + , subq_5.bio_added_ts__extract_doy + , subq_5.last_login_ts__minute + , subq_5.last_login_ts__hour + , subq_5.last_login_ts__day + , subq_5.last_login_ts__week + , subq_5.last_login_ts__month + , subq_5.last_login_ts__quarter + , subq_5.last_login_ts__year + , subq_5.last_login_ts__extract_year + , subq_5.last_login_ts__extract_quarter + , subq_5.last_login_ts__extract_month + , subq_5.last_login_ts__extract_day + , subq_5.last_login_ts__extract_dow + , subq_5.last_login_ts__extract_doy + , subq_5.archived_at__hour + , subq_5.archived_at__day + , subq_5.archived_at__week + , subq_5.archived_at__month + , subq_5.archived_at__quarter + , subq_5.archived_at__year + , subq_5.archived_at__extract_year + , subq_5.archived_at__extract_quarter + , subq_5.archived_at__extract_month + , subq_5.archived_at__extract_day + , subq_5.archived_at__extract_dow + , subq_5.archived_at__extract_doy + , subq_5.user__ds__day + , subq_5.user__ds__week + , subq_5.user__ds__month + , subq_5.user__ds__quarter + , subq_5.user__ds__year + , subq_5.user__ds__extract_year + , subq_5.user__ds__extract_quarter + , subq_5.user__ds__extract_month + , subq_5.user__ds__extract_day + , subq_5.user__ds__extract_dow + , subq_5.user__ds__extract_doy + , subq_5.user__created_at__day + , subq_5.user__created_at__week + , subq_5.user__created_at__month + , subq_5.user__created_at__quarter + , subq_5.user__created_at__year + , subq_5.user__created_at__extract_year + , subq_5.user__created_at__extract_quarter + , subq_5.user__created_at__extract_month + , subq_5.user__created_at__extract_day + , subq_5.user__created_at__extract_dow + , subq_5.user__created_at__extract_doy + , subq_5.user__ds_partitioned__day + , subq_5.user__ds_partitioned__week + , subq_5.user__ds_partitioned__month + , subq_5.user__ds_partitioned__quarter + , subq_5.user__ds_partitioned__year + , subq_5.user__ds_partitioned__extract_year + , subq_5.user__ds_partitioned__extract_quarter + , subq_5.user__ds_partitioned__extract_month + , subq_5.user__ds_partitioned__extract_day + , subq_5.user__ds_partitioned__extract_dow + , subq_5.user__ds_partitioned__extract_doy + , subq_5.user__last_profile_edit_ts__millisecond + , subq_5.user__last_profile_edit_ts__second + , subq_5.user__last_profile_edit_ts__minute + , subq_5.user__last_profile_edit_ts__hour + , subq_5.user__last_profile_edit_ts__day + , subq_5.user__last_profile_edit_ts__week + , subq_5.user__last_profile_edit_ts__month + , subq_5.user__last_profile_edit_ts__quarter + , subq_5.user__last_profile_edit_ts__year + , subq_5.user__last_profile_edit_ts__extract_year + , subq_5.user__last_profile_edit_ts__extract_quarter + , subq_5.user__last_profile_edit_ts__extract_month + , subq_5.user__last_profile_edit_ts__extract_day + , subq_5.user__last_profile_edit_ts__extract_dow + , subq_5.user__last_profile_edit_ts__extract_doy + , subq_5.user__bio_added_ts__second + , subq_5.user__bio_added_ts__minute + , subq_5.user__bio_added_ts__hour + , subq_5.user__bio_added_ts__day + , subq_5.user__bio_added_ts__week + , subq_5.user__bio_added_ts__month + , subq_5.user__bio_added_ts__quarter + , subq_5.user__bio_added_ts__year + , subq_5.user__bio_added_ts__extract_year + , subq_5.user__bio_added_ts__extract_quarter + , subq_5.user__bio_added_ts__extract_month + , subq_5.user__bio_added_ts__extract_day + , subq_5.user__bio_added_ts__extract_dow + , subq_5.user__bio_added_ts__extract_doy + , subq_5.user__last_login_ts__minute + , subq_5.user__last_login_ts__hour + , subq_5.user__last_login_ts__day + , subq_5.user__last_login_ts__week + , subq_5.user__last_login_ts__month + , subq_5.user__last_login_ts__quarter + , subq_5.user__last_login_ts__year + , subq_5.user__last_login_ts__extract_year + , subq_5.user__last_login_ts__extract_quarter + , subq_5.user__last_login_ts__extract_month + , subq_5.user__last_login_ts__extract_day + , subq_5.user__last_login_ts__extract_dow + , subq_5.user__last_login_ts__extract_doy + , subq_5.user__archived_at__hour + , subq_5.user__archived_at__day + , subq_5.user__archived_at__week + , subq_5.user__archived_at__month + , subq_5.user__archived_at__quarter + , subq_5.user__archived_at__year + , subq_5.user__archived_at__extract_year + , subq_5.user__archived_at__extract_quarter + , subq_5.user__archived_at__extract_month + , subq_5.user__archived_at__extract_day + , subq_5.user__archived_at__extract_dow + , subq_5.user__archived_at__extract_doy + , subq_5.created_at__day AS metric_time__day + , subq_5.created_at__week AS metric_time__week + , subq_5.created_at__month AS metric_time__month + , subq_5.created_at__quarter AS metric_time__quarter + , subq_5.created_at__year AS metric_time__year + , subq_5.created_at__extract_year AS metric_time__extract_year + , subq_5.created_at__extract_quarter AS metric_time__extract_quarter + , subq_5.created_at__extract_month AS metric_time__extract_month + , subq_5.created_at__extract_day AS metric_time__extract_day + , subq_5.created_at__extract_dow AS metric_time__extract_dow + , subq_5.created_at__extract_doy AS metric_time__extract_doy + , subq_5.user + , subq_5.home_state + , subq_5.user__home_state + , subq_5.new_users + FROM ( + -- Read Elements From Semantic Model 'users_ds_source' + SELECT + 1 AS new_users + , 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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_5 + ) subq_6 + ) subq_7 + ON + subq_4.user = subq_7.user + ) subq_8 + ) subq_9 + ON + ( + subq_2.listing = subq_9.listing + ) AND ( + subq_2.ds_partitioned__day = subq_9.user__ds_partitioned__day + ) + ) subq_10 + ) subq_11 + GROUP BY + subq_11.listing__user__bio_added_ts__minute +) subq_12 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql new file mode 100644 index 0000000000..d93a3918ba --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql @@ -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 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_metric_with_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_metric_with_sub_daily_dimension__plan0.sql new file mode 100644 index 0000000000..537ea209e7 --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_metric_with_sub_daily_dimension__plan0.sql @@ -0,0 +1,394 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.user__archived_at__hour + , subq_3.new_users +FROM ( + -- Aggregate Measures + SELECT + subq_2.user__archived_at__hour + , SUM(subq_2.new_users) AS new_users + FROM ( + -- Pass Only Elements: ['new_users', 'user__archived_at__hour'] + SELECT + subq_1.user__archived_at__hour + , subq_1.new_users + FROM ( + -- Metric Time Dimension 'created_at' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.created_at__day + , subq_0.created_at__week + , subq_0.created_at__month + , subq_0.created_at__quarter + , subq_0.created_at__year + , subq_0.created_at__extract_year + , subq_0.created_at__extract_quarter + , subq_0.created_at__extract_month + , subq_0.created_at__extract_day + , subq_0.created_at__extract_dow + , subq_0.created_at__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.last_profile_edit_ts__millisecond + , subq_0.last_profile_edit_ts__second + , subq_0.last_profile_edit_ts__minute + , subq_0.last_profile_edit_ts__hour + , subq_0.last_profile_edit_ts__day + , subq_0.last_profile_edit_ts__week + , subq_0.last_profile_edit_ts__month + , subq_0.last_profile_edit_ts__quarter + , subq_0.last_profile_edit_ts__year + , subq_0.last_profile_edit_ts__extract_year + , subq_0.last_profile_edit_ts__extract_quarter + , subq_0.last_profile_edit_ts__extract_month + , subq_0.last_profile_edit_ts__extract_day + , subq_0.last_profile_edit_ts__extract_dow + , subq_0.last_profile_edit_ts__extract_doy + , subq_0.bio_added_ts__second + , subq_0.bio_added_ts__minute + , subq_0.bio_added_ts__hour + , subq_0.bio_added_ts__day + , subq_0.bio_added_ts__week + , subq_0.bio_added_ts__month + , subq_0.bio_added_ts__quarter + , subq_0.bio_added_ts__year + , subq_0.bio_added_ts__extract_year + , subq_0.bio_added_ts__extract_quarter + , subq_0.bio_added_ts__extract_month + , subq_0.bio_added_ts__extract_day + , subq_0.bio_added_ts__extract_dow + , subq_0.bio_added_ts__extract_doy + , subq_0.last_login_ts__minute + , subq_0.last_login_ts__hour + , subq_0.last_login_ts__day + , subq_0.last_login_ts__week + , subq_0.last_login_ts__month + , subq_0.last_login_ts__quarter + , subq_0.last_login_ts__year + , subq_0.last_login_ts__extract_year + , subq_0.last_login_ts__extract_quarter + , subq_0.last_login_ts__extract_month + , subq_0.last_login_ts__extract_day + , subq_0.last_login_ts__extract_dow + , subq_0.last_login_ts__extract_doy + , subq_0.archived_at__hour + , subq_0.archived_at__day + , subq_0.archived_at__week + , subq_0.archived_at__month + , subq_0.archived_at__quarter + , subq_0.archived_at__year + , subq_0.archived_at__extract_year + , subq_0.archived_at__extract_quarter + , subq_0.archived_at__extract_month + , subq_0.archived_at__extract_day + , subq_0.archived_at__extract_dow + , subq_0.archived_at__extract_doy + , subq_0.user__ds__day + , subq_0.user__ds__week + , subq_0.user__ds__month + , subq_0.user__ds__quarter + , subq_0.user__ds__year + , subq_0.user__ds__extract_year + , subq_0.user__ds__extract_quarter + , subq_0.user__ds__extract_month + , subq_0.user__ds__extract_day + , subq_0.user__ds__extract_dow + , subq_0.user__ds__extract_doy + , subq_0.user__created_at__day + , subq_0.user__created_at__week + , subq_0.user__created_at__month + , subq_0.user__created_at__quarter + , subq_0.user__created_at__year + , subq_0.user__created_at__extract_year + , subq_0.user__created_at__extract_quarter + , subq_0.user__created_at__extract_month + , subq_0.user__created_at__extract_day + , subq_0.user__created_at__extract_dow + , subq_0.user__created_at__extract_doy + , subq_0.user__ds_partitioned__day + , subq_0.user__ds_partitioned__week + , subq_0.user__ds_partitioned__month + , subq_0.user__ds_partitioned__quarter + , subq_0.user__ds_partitioned__year + , subq_0.user__ds_partitioned__extract_year + , subq_0.user__ds_partitioned__extract_quarter + , subq_0.user__ds_partitioned__extract_month + , subq_0.user__ds_partitioned__extract_day + , subq_0.user__ds_partitioned__extract_dow + , subq_0.user__ds_partitioned__extract_doy + , subq_0.user__last_profile_edit_ts__millisecond + , subq_0.user__last_profile_edit_ts__second + , subq_0.user__last_profile_edit_ts__minute + , subq_0.user__last_profile_edit_ts__hour + , subq_0.user__last_profile_edit_ts__day + , subq_0.user__last_profile_edit_ts__week + , subq_0.user__last_profile_edit_ts__month + , subq_0.user__last_profile_edit_ts__quarter + , subq_0.user__last_profile_edit_ts__year + , subq_0.user__last_profile_edit_ts__extract_year + , subq_0.user__last_profile_edit_ts__extract_quarter + , subq_0.user__last_profile_edit_ts__extract_month + , subq_0.user__last_profile_edit_ts__extract_day + , subq_0.user__last_profile_edit_ts__extract_dow + , subq_0.user__last_profile_edit_ts__extract_doy + , subq_0.user__bio_added_ts__second + , subq_0.user__bio_added_ts__minute + , subq_0.user__bio_added_ts__hour + , subq_0.user__bio_added_ts__day + , subq_0.user__bio_added_ts__week + , subq_0.user__bio_added_ts__month + , subq_0.user__bio_added_ts__quarter + , subq_0.user__bio_added_ts__year + , subq_0.user__bio_added_ts__extract_year + , subq_0.user__bio_added_ts__extract_quarter + , subq_0.user__bio_added_ts__extract_month + , subq_0.user__bio_added_ts__extract_day + , subq_0.user__bio_added_ts__extract_dow + , subq_0.user__bio_added_ts__extract_doy + , subq_0.user__last_login_ts__minute + , subq_0.user__last_login_ts__hour + , subq_0.user__last_login_ts__day + , subq_0.user__last_login_ts__week + , subq_0.user__last_login_ts__month + , subq_0.user__last_login_ts__quarter + , subq_0.user__last_login_ts__year + , subq_0.user__last_login_ts__extract_year + , subq_0.user__last_login_ts__extract_quarter + , subq_0.user__last_login_ts__extract_month + , subq_0.user__last_login_ts__extract_day + , subq_0.user__last_login_ts__extract_dow + , subq_0.user__last_login_ts__extract_doy + , subq_0.user__archived_at__hour + , subq_0.user__archived_at__day + , subq_0.user__archived_at__week + , subq_0.user__archived_at__month + , subq_0.user__archived_at__quarter + , subq_0.user__archived_at__year + , subq_0.user__archived_at__extract_year + , subq_0.user__archived_at__extract_quarter + , subq_0.user__archived_at__extract_month + , subq_0.user__archived_at__extract_day + , subq_0.user__archived_at__extract_dow + , subq_0.user__archived_at__extract_doy + , subq_0.created_at__day AS metric_time__day + , subq_0.created_at__week AS metric_time__week + , subq_0.created_at__month AS metric_time__month + , subq_0.created_at__quarter AS metric_time__quarter + , subq_0.created_at__year AS metric_time__year + , subq_0.created_at__extract_year AS metric_time__extract_year + , subq_0.created_at__extract_quarter AS metric_time__extract_quarter + , subq_0.created_at__extract_month AS metric_time__extract_month + , subq_0.created_at__extract_day AS metric_time__extract_day + , subq_0.created_at__extract_dow AS metric_time__extract_dow + , subq_0.created_at__extract_doy AS metric_time__extract_doy + , subq_0.user + , subq_0.home_state + , subq_0.user__home_state + , subq_0.new_users + FROM ( + -- Read Elements From Semantic Model 'users_ds_source' + SELECT + 1 AS new_users + , 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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(dayofweekiso 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 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.user__archived_at__hour +) subq_3 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql new file mode 100644 index 0000000000..c20146c881 --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql @@ -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 + DATE_TRUNC('hour', archived_at) 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 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql new file mode 100644 index 0000000000..215741cd3e --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql @@ -0,0 +1,1303 @@ +-- Compute Metrics via Expressions +SELECT + subq_12.listing__user__bio_added_ts__minute + , subq_12.bookings +FROM ( + -- Aggregate Measures + SELECT + subq_11.listing__user__bio_added_ts__minute + , SUM(subq_11.bookings) AS bookings + FROM ( + -- Pass Only Elements: ['bookings', 'listing__user__bio_added_ts__minute'] + SELECT + subq_10.listing__user__bio_added_ts__minute + , subq_10.bookings + FROM ( + -- Join Standard Outputs + SELECT + subq_2.ds_partitioned__day AS ds_partitioned__day + , subq_9.user__ds_partitioned__day AS listing__user__ds_partitioned__day + , subq_9.user__bio_added_ts__minute AS listing__user__bio_added_ts__minute + , subq_2.listing AS listing + , subq_2.bookings AS bookings + FROM ( + -- Pass Only Elements: ['bookings', 'ds_partitioned__day', 'listing'] + SELECT + subq_1.ds_partitioned__day + , subq_1.listing + , subq_1.bookings + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.paid_at__day + , subq_0.paid_at__week + , subq_0.paid_at__month + , subq_0.paid_at__quarter + , subq_0.paid_at__year + , subq_0.paid_at__extract_year + , subq_0.paid_at__extract_quarter + , subq_0.paid_at__extract_month + , subq_0.paid_at__extract_day + , subq_0.paid_at__extract_dow + , subq_0.paid_at__extract_doy + , subq_0.booking__ds__day + , subq_0.booking__ds__week + , subq_0.booking__ds__month + , subq_0.booking__ds__quarter + , subq_0.booking__ds__year + , subq_0.booking__ds__extract_year + , subq_0.booking__ds__extract_quarter + , subq_0.booking__ds__extract_month + , subq_0.booking__ds__extract_day + , subq_0.booking__ds__extract_dow + , subq_0.booking__ds__extract_doy + , subq_0.booking__ds_partitioned__day + , subq_0.booking__ds_partitioned__week + , subq_0.booking__ds_partitioned__month + , subq_0.booking__ds_partitioned__quarter + , subq_0.booking__ds_partitioned__year + , subq_0.booking__ds_partitioned__extract_year + , subq_0.booking__ds_partitioned__extract_quarter + , subq_0.booking__ds_partitioned__extract_month + , subq_0.booking__ds_partitioned__extract_day + , subq_0.booking__ds_partitioned__extract_dow + , subq_0.booking__ds_partitioned__extract_doy + , subq_0.booking__paid_at__day + , subq_0.booking__paid_at__week + , subq_0.booking__paid_at__month + , subq_0.booking__paid_at__quarter + , subq_0.booking__paid_at__year + , subq_0.booking__paid_at__extract_year + , subq_0.booking__paid_at__extract_quarter + , subq_0.booking__paid_at__extract_month + , subq_0.booking__paid_at__extract_day + , subq_0.booking__paid_at__extract_dow + , subq_0.booking__paid_at__extract_doy + , subq_0.ds__day AS metric_time__day + , subq_0.ds__week AS metric_time__week + , subq_0.ds__month AS metric_time__month + , subq_0.ds__quarter AS metric_time__quarter + , subq_0.ds__year AS metric_time__year + , subq_0.ds__extract_year AS metric_time__extract_year + , subq_0.ds__extract_quarter AS metric_time__extract_quarter + , subq_0.ds__extract_month AS metric_time__extract_month + , subq_0.ds__extract_day AS metric_time__extract_day + , subq_0.ds__extract_dow AS metric_time__extract_dow + , subq_0.ds__extract_doy AS metric_time__extract_doy + , subq_0.listing + , subq_0.guest + , subq_0.host + , subq_0.booking__listing + , subq_0.booking__guest + , subq_0.booking__host + , subq_0.is_instant + , subq_0.booking__is_instant + , subq_0.bookings + , subq_0.instant_bookings + , subq_0.booking_value + , subq_0.max_booking_value + , subq_0.min_booking_value + , subq_0.bookers + , subq_0.average_booking_value + , subq_0.referred_bookings + , subq_0.median_booking_value + , subq_0.booking_value_p99 + , subq_0.discrete_booking_value_p99 + , subq_0.approximate_continuous_booking_value_p99 + , subq_0.approximate_discrete_booking_value_p99 + FROM ( + -- Read Elements From Semantic Model 'bookings_source' + SELECT + 1 AS bookings + , CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings + , bookings_source_src_28000.booking_value + , bookings_source_src_28000.booking_value AS max_booking_value + , bookings_source_src_28000.booking_value AS min_booking_value + , bookings_source_src_28000.guest_id AS bookers + , bookings_source_src_28000.booking_value AS average_booking_value + , bookings_source_src_28000.booking_value AS booking_payments + , CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings + , bookings_source_src_28000.booking_value AS median_booking_value + , bookings_source_src_28000.booking_value AS booking_value_p99 + , bookings_source_src_28000.booking_value AS discrete_booking_value_p99 + , bookings_source_src_28000.booking_value AS approximate_continuous_booking_value_p99 + , bookings_source_src_28000.booking_value AS approximate_discrete_booking_value_p99 + , bookings_source_src_28000.is_instant + , DATE_TRUNC('day', bookings_source_src_28000.ds) AS ds__day + , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week + , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds) AS ds__year + , EXTRACT(year FROM bookings_source_src_28000.ds) AS ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds) AS ds__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds) AS ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day + , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week + , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28000.paid_at) AS paid_at__year + , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy + , bookings_source_src_28000.is_instant AS booking__is_instant + , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day + , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week + , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds) AS booking__ds__year + , EXTRACT(year FROM bookings_source_src_28000.ds) AS booking__ds__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds) AS booking__ds__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds) AS booking__ds__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds) AS booking__ds__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day + , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week + , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month + , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter + , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__year + , EXTRACT(year FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_month + , EXTRACT(day FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy + , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day + , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week + , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month + , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter + , DATE_TRUNC('year', bookings_source_src_28000.paid_at) AS booking__paid_at__year + , EXTRACT(year FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_year + , EXTRACT(quarter FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_quarter + , EXTRACT(month FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_month + , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day + , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow + , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy + , bookings_source_src_28000.listing_id AS listing + , bookings_source_src_28000.guest_id AS guest + , bookings_source_src_28000.host_id AS host + , bookings_source_src_28000.listing_id AS booking__listing + , bookings_source_src_28000.guest_id AS booking__guest + , bookings_source_src_28000.host_id AS booking__host + FROM ***************************.fct_bookings bookings_source_src_28000 + ) subq_0 + ) subq_1 + ) subq_2 + LEFT OUTER JOIN ( + -- Pass Only Elements: ['user__ds_partitioned__day', 'user__bio_added_ts__minute', 'listing'] + SELECT + subq_8.user__ds_partitioned__day + , subq_8.user__bio_added_ts__minute + , subq_8.listing + FROM ( + -- Join Standard Outputs + SELECT + subq_4.ds__day AS ds__day + , subq_4.ds__week AS ds__week + , subq_4.ds__month AS ds__month + , subq_4.ds__quarter AS ds__quarter + , subq_4.ds__year AS ds__year + , subq_4.ds__extract_year AS ds__extract_year + , subq_4.ds__extract_quarter AS ds__extract_quarter + , subq_4.ds__extract_month AS ds__extract_month + , subq_4.ds__extract_day AS ds__extract_day + , subq_4.ds__extract_dow AS ds__extract_dow + , subq_4.ds__extract_doy AS ds__extract_doy + , subq_4.created_at__day AS created_at__day + , subq_4.created_at__week AS created_at__week + , subq_4.created_at__month AS created_at__month + , subq_4.created_at__quarter AS created_at__quarter + , subq_4.created_at__year AS created_at__year + , subq_4.created_at__extract_year AS created_at__extract_year + , subq_4.created_at__extract_quarter AS created_at__extract_quarter + , subq_4.created_at__extract_month AS created_at__extract_month + , subq_4.created_at__extract_day AS created_at__extract_day + , subq_4.created_at__extract_dow AS created_at__extract_dow + , subq_4.created_at__extract_doy AS created_at__extract_doy + , subq_4.listing__ds__day AS listing__ds__day + , subq_4.listing__ds__week AS listing__ds__week + , subq_4.listing__ds__month AS listing__ds__month + , subq_4.listing__ds__quarter AS listing__ds__quarter + , subq_4.listing__ds__year AS listing__ds__year + , subq_4.listing__ds__extract_year AS listing__ds__extract_year + , subq_4.listing__ds__extract_quarter AS listing__ds__extract_quarter + , subq_4.listing__ds__extract_month AS listing__ds__extract_month + , subq_4.listing__ds__extract_day AS listing__ds__extract_day + , subq_4.listing__ds__extract_dow AS listing__ds__extract_dow + , subq_4.listing__ds__extract_doy AS listing__ds__extract_doy + , subq_4.listing__created_at__day AS listing__created_at__day + , subq_4.listing__created_at__week AS listing__created_at__week + , subq_4.listing__created_at__month AS listing__created_at__month + , subq_4.listing__created_at__quarter AS listing__created_at__quarter + , subq_4.listing__created_at__year AS listing__created_at__year + , subq_4.listing__created_at__extract_year AS listing__created_at__extract_year + , subq_4.listing__created_at__extract_quarter AS listing__created_at__extract_quarter + , subq_4.listing__created_at__extract_month AS listing__created_at__extract_month + , subq_4.listing__created_at__extract_day AS listing__created_at__extract_day + , subq_4.listing__created_at__extract_dow AS listing__created_at__extract_dow + , subq_4.listing__created_at__extract_doy AS listing__created_at__extract_doy + , subq_4.metric_time__day AS metric_time__day + , 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_7.ds__day AS user__ds__day + , subq_7.ds__week AS user__ds__week + , subq_7.ds__month AS user__ds__month + , subq_7.ds__quarter AS user__ds__quarter + , subq_7.ds__year AS user__ds__year + , subq_7.ds__extract_year AS user__ds__extract_year + , subq_7.ds__extract_quarter AS user__ds__extract_quarter + , subq_7.ds__extract_month AS user__ds__extract_month + , subq_7.ds__extract_day AS user__ds__extract_day + , subq_7.ds__extract_dow AS user__ds__extract_dow + , subq_7.ds__extract_doy AS user__ds__extract_doy + , subq_7.created_at__day AS user__created_at__day + , subq_7.created_at__week AS user__created_at__week + , subq_7.created_at__month AS user__created_at__month + , subq_7.created_at__quarter AS user__created_at__quarter + , subq_7.created_at__year AS user__created_at__year + , subq_7.created_at__extract_year AS user__created_at__extract_year + , subq_7.created_at__extract_quarter AS user__created_at__extract_quarter + , subq_7.created_at__extract_month AS user__created_at__extract_month + , subq_7.created_at__extract_day AS user__created_at__extract_day + , subq_7.created_at__extract_dow AS user__created_at__extract_dow + , subq_7.created_at__extract_doy AS user__created_at__extract_doy + , subq_7.ds_partitioned__day AS user__ds_partitioned__day + , subq_7.ds_partitioned__week AS user__ds_partitioned__week + , subq_7.ds_partitioned__month AS user__ds_partitioned__month + , subq_7.ds_partitioned__quarter AS user__ds_partitioned__quarter + , subq_7.ds_partitioned__year AS user__ds_partitioned__year + , subq_7.ds_partitioned__extract_year AS user__ds_partitioned__extract_year + , subq_7.ds_partitioned__extract_quarter AS user__ds_partitioned__extract_quarter + , subq_7.ds_partitioned__extract_month AS user__ds_partitioned__extract_month + , subq_7.ds_partitioned__extract_day AS user__ds_partitioned__extract_day + , subq_7.ds_partitioned__extract_dow AS user__ds_partitioned__extract_dow + , subq_7.ds_partitioned__extract_doy AS user__ds_partitioned__extract_doy + , subq_7.last_profile_edit_ts__millisecond AS user__last_profile_edit_ts__millisecond + , subq_7.last_profile_edit_ts__second AS user__last_profile_edit_ts__second + , subq_7.last_profile_edit_ts__minute AS user__last_profile_edit_ts__minute + , subq_7.last_profile_edit_ts__hour AS user__last_profile_edit_ts__hour + , subq_7.last_profile_edit_ts__day AS user__last_profile_edit_ts__day + , subq_7.last_profile_edit_ts__week AS user__last_profile_edit_ts__week + , subq_7.last_profile_edit_ts__month AS user__last_profile_edit_ts__month + , subq_7.last_profile_edit_ts__quarter AS user__last_profile_edit_ts__quarter + , subq_7.last_profile_edit_ts__year AS user__last_profile_edit_ts__year + , subq_7.last_profile_edit_ts__extract_year AS user__last_profile_edit_ts__extract_year + , subq_7.last_profile_edit_ts__extract_quarter AS user__last_profile_edit_ts__extract_quarter + , subq_7.last_profile_edit_ts__extract_month AS user__last_profile_edit_ts__extract_month + , subq_7.last_profile_edit_ts__extract_day AS user__last_profile_edit_ts__extract_day + , subq_7.last_profile_edit_ts__extract_dow AS user__last_profile_edit_ts__extract_dow + , subq_7.last_profile_edit_ts__extract_doy AS user__last_profile_edit_ts__extract_doy + , subq_7.bio_added_ts__second AS user__bio_added_ts__second + , subq_7.bio_added_ts__minute AS user__bio_added_ts__minute + , subq_7.bio_added_ts__hour AS user__bio_added_ts__hour + , subq_7.bio_added_ts__day AS user__bio_added_ts__day + , subq_7.bio_added_ts__week AS user__bio_added_ts__week + , subq_7.bio_added_ts__month AS user__bio_added_ts__month + , subq_7.bio_added_ts__quarter AS user__bio_added_ts__quarter + , subq_7.bio_added_ts__year AS user__bio_added_ts__year + , subq_7.bio_added_ts__extract_year AS user__bio_added_ts__extract_year + , subq_7.bio_added_ts__extract_quarter AS user__bio_added_ts__extract_quarter + , subq_7.bio_added_ts__extract_month AS user__bio_added_ts__extract_month + , subq_7.bio_added_ts__extract_day AS user__bio_added_ts__extract_day + , subq_7.bio_added_ts__extract_dow AS user__bio_added_ts__extract_dow + , subq_7.bio_added_ts__extract_doy AS user__bio_added_ts__extract_doy + , subq_7.last_login_ts__minute AS user__last_login_ts__minute + , subq_7.last_login_ts__hour AS user__last_login_ts__hour + , subq_7.last_login_ts__day AS user__last_login_ts__day + , subq_7.last_login_ts__week AS user__last_login_ts__week + , subq_7.last_login_ts__month AS user__last_login_ts__month + , subq_7.last_login_ts__quarter AS user__last_login_ts__quarter + , subq_7.last_login_ts__year AS user__last_login_ts__year + , subq_7.last_login_ts__extract_year AS user__last_login_ts__extract_year + , subq_7.last_login_ts__extract_quarter AS user__last_login_ts__extract_quarter + , subq_7.last_login_ts__extract_month AS user__last_login_ts__extract_month + , subq_7.last_login_ts__extract_day AS user__last_login_ts__extract_day + , subq_7.last_login_ts__extract_dow AS user__last_login_ts__extract_dow + , subq_7.last_login_ts__extract_doy AS user__last_login_ts__extract_doy + , subq_7.archived_at__hour AS user__archived_at__hour + , subq_7.archived_at__day AS user__archived_at__day + , subq_7.archived_at__week AS user__archived_at__week + , subq_7.archived_at__month AS user__archived_at__month + , subq_7.archived_at__quarter AS user__archived_at__quarter + , subq_7.archived_at__year AS user__archived_at__year + , subq_7.archived_at__extract_year AS user__archived_at__extract_year + , subq_7.archived_at__extract_quarter AS user__archived_at__extract_quarter + , subq_7.archived_at__extract_month AS user__archived_at__extract_month + , subq_7.archived_at__extract_day AS user__archived_at__extract_day + , subq_7.archived_at__extract_dow AS user__archived_at__extract_dow + , subq_7.archived_at__extract_doy AS user__archived_at__extract_doy + , subq_7.metric_time__day AS user__metric_time__day + , subq_7.metric_time__week AS user__metric_time__week + , subq_7.metric_time__month AS user__metric_time__month + , subq_7.metric_time__quarter AS user__metric_time__quarter + , subq_7.metric_time__year AS user__metric_time__year + , subq_7.metric_time__extract_year AS user__metric_time__extract_year + , subq_7.metric_time__extract_quarter AS user__metric_time__extract_quarter + , subq_7.metric_time__extract_month AS user__metric_time__extract_month + , subq_7.metric_time__extract_day AS user__metric_time__extract_day + , subq_7.metric_time__extract_dow AS user__metric_time__extract_dow + , subq_7.metric_time__extract_doy AS user__metric_time__extract_doy + , subq_4.listing AS listing + , subq_4.user AS user + , subq_4.listing__user AS listing__user + , subq_4.country_latest AS country_latest + , subq_4.is_lux_latest AS is_lux_latest + , subq_4.capacity_latest AS capacity_latest + , subq_4.listing__country_latest AS listing__country_latest + , subq_4.listing__is_lux_latest AS listing__is_lux_latest + , subq_4.listing__capacity_latest AS listing__capacity_latest + , subq_7.home_state AS user__home_state + , subq_4.listings AS listings + , subq_4.largest_listing AS largest_listing + , subq_4.smallest_listing AS smallest_listing + FROM ( + -- Metric Time Dimension 'ds' + SELECT + subq_3.ds__day + , subq_3.ds__week + , subq_3.ds__month + , subq_3.ds__quarter + , subq_3.ds__year + , subq_3.ds__extract_year + , subq_3.ds__extract_quarter + , subq_3.ds__extract_month + , subq_3.ds__extract_day + , subq_3.ds__extract_dow + , subq_3.ds__extract_doy + , subq_3.created_at__day + , subq_3.created_at__week + , subq_3.created_at__month + , subq_3.created_at__quarter + , subq_3.created_at__year + , subq_3.created_at__extract_year + , subq_3.created_at__extract_quarter + , subq_3.created_at__extract_month + , subq_3.created_at__extract_day + , subq_3.created_at__extract_dow + , subq_3.created_at__extract_doy + , subq_3.listing__ds__day + , subq_3.listing__ds__week + , subq_3.listing__ds__month + , subq_3.listing__ds__quarter + , subq_3.listing__ds__year + , subq_3.listing__ds__extract_year + , subq_3.listing__ds__extract_quarter + , subq_3.listing__ds__extract_month + , subq_3.listing__ds__extract_day + , subq_3.listing__ds__extract_dow + , subq_3.listing__ds__extract_doy + , subq_3.listing__created_at__day + , subq_3.listing__created_at__week + , subq_3.listing__created_at__month + , subq_3.listing__created_at__quarter + , subq_3.listing__created_at__year + , subq_3.listing__created_at__extract_year + , subq_3.listing__created_at__extract_quarter + , subq_3.listing__created_at__extract_month + , subq_3.listing__created_at__extract_day + , subq_3.listing__created_at__extract_dow + , subq_3.listing__created_at__extract_doy + , subq_3.ds__day AS metric_time__day + , subq_3.ds__week AS metric_time__week + , subq_3.ds__month AS metric_time__month + , subq_3.ds__quarter AS metric_time__quarter + , subq_3.ds__year AS metric_time__year + , subq_3.ds__extract_year AS metric_time__extract_year + , subq_3.ds__extract_quarter AS metric_time__extract_quarter + , subq_3.ds__extract_month AS metric_time__extract_month + , subq_3.ds__extract_day AS metric_time__extract_day + , subq_3.ds__extract_dow AS metric_time__extract_dow + , subq_3.ds__extract_doy AS metric_time__extract_doy + , subq_3.listing + , subq_3.user + , subq_3.listing__user + , subq_3.country_latest + , subq_3.is_lux_latest + , subq_3.capacity_latest + , subq_3.listing__country_latest + , subq_3.listing__is_lux_latest + , subq_3.listing__capacity_latest + , subq_3.listings + , subq_3.largest_listing + , subq_3.smallest_listing + FROM ( + -- Read Elements From Semantic Model 'listings_latest' + SELECT + 1 AS listings + , listings_latest_src_28000.capacity AS largest_listing + , listings_latest_src_28000.capacity AS smallest_listing + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS created_at__extract_dow + , EXTRACT(doy 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 + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__ds__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow + , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy + , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day + , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week + , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month + , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter + , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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 + , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow + , EXTRACT(doy 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 + FROM ***************************.dim_listings_latest listings_latest_src_28000 + ) subq_3 + ) subq_4 + LEFT OUTER JOIN ( + -- Pass Only Elements: [ + -- 'home_state', + -- 'user__home_state', + -- 'ds__day', + -- 'ds__week', + -- 'ds__month', + -- 'ds__quarter', + -- 'ds__year', + -- 'ds__extract_year', + -- 'ds__extract_quarter', + -- 'ds__extract_month', + -- 'ds__extract_day', + -- 'ds__extract_dow', + -- 'ds__extract_doy', + -- 'created_at__day', + -- 'created_at__week', + -- 'created_at__month', + -- 'created_at__quarter', + -- 'created_at__year', + -- 'created_at__extract_year', + -- 'created_at__extract_quarter', + -- 'created_at__extract_month', + -- 'created_at__extract_day', + -- 'created_at__extract_dow', + -- 'created_at__extract_doy', + -- 'ds_partitioned__day', + -- 'ds_partitioned__week', + -- 'ds_partitioned__month', + -- 'ds_partitioned__quarter', + -- 'ds_partitioned__year', + -- 'ds_partitioned__extract_year', + -- 'ds_partitioned__extract_quarter', + -- 'ds_partitioned__extract_month', + -- 'ds_partitioned__extract_day', + -- 'ds_partitioned__extract_dow', + -- 'ds_partitioned__extract_doy', + -- 'last_profile_edit_ts__millisecond', + -- 'last_profile_edit_ts__second', + -- 'last_profile_edit_ts__minute', + -- 'last_profile_edit_ts__hour', + -- 'last_profile_edit_ts__day', + -- 'last_profile_edit_ts__week', + -- 'last_profile_edit_ts__month', + -- 'last_profile_edit_ts__quarter', + -- 'last_profile_edit_ts__year', + -- 'last_profile_edit_ts__extract_year', + -- 'last_profile_edit_ts__extract_quarter', + -- 'last_profile_edit_ts__extract_month', + -- 'last_profile_edit_ts__extract_day', + -- 'last_profile_edit_ts__extract_dow', + -- 'last_profile_edit_ts__extract_doy', + -- 'bio_added_ts__second', + -- 'bio_added_ts__minute', + -- 'bio_added_ts__hour', + -- 'bio_added_ts__day', + -- 'bio_added_ts__week', + -- 'bio_added_ts__month', + -- 'bio_added_ts__quarter', + -- 'bio_added_ts__year', + -- 'bio_added_ts__extract_year', + -- 'bio_added_ts__extract_quarter', + -- 'bio_added_ts__extract_month', + -- 'bio_added_ts__extract_day', + -- 'bio_added_ts__extract_dow', + -- 'bio_added_ts__extract_doy', + -- 'last_login_ts__minute', + -- 'last_login_ts__hour', + -- 'last_login_ts__day', + -- 'last_login_ts__week', + -- 'last_login_ts__month', + -- 'last_login_ts__quarter', + -- 'last_login_ts__year', + -- 'last_login_ts__extract_year', + -- 'last_login_ts__extract_quarter', + -- 'last_login_ts__extract_month', + -- 'last_login_ts__extract_day', + -- 'last_login_ts__extract_dow', + -- 'last_login_ts__extract_doy', + -- 'archived_at__hour', + -- 'archived_at__day', + -- 'archived_at__week', + -- 'archived_at__month', + -- 'archived_at__quarter', + -- 'archived_at__year', + -- 'archived_at__extract_year', + -- 'archived_at__extract_quarter', + -- 'archived_at__extract_month', + -- 'archived_at__extract_day', + -- 'archived_at__extract_dow', + -- 'archived_at__extract_doy', + -- 'user__ds__day', + -- 'user__ds__week', + -- 'user__ds__month', + -- 'user__ds__quarter', + -- 'user__ds__year', + -- 'user__ds__extract_year', + -- 'user__ds__extract_quarter', + -- 'user__ds__extract_month', + -- 'user__ds__extract_day', + -- 'user__ds__extract_dow', + -- 'user__ds__extract_doy', + -- 'user__created_at__day', + -- 'user__created_at__week', + -- 'user__created_at__month', + -- 'user__created_at__quarter', + -- 'user__created_at__year', + -- 'user__created_at__extract_year', + -- 'user__created_at__extract_quarter', + -- 'user__created_at__extract_month', + -- 'user__created_at__extract_day', + -- 'user__created_at__extract_dow', + -- 'user__created_at__extract_doy', + -- 'user__ds_partitioned__day', + -- 'user__ds_partitioned__week', + -- 'user__ds_partitioned__month', + -- 'user__ds_partitioned__quarter', + -- 'user__ds_partitioned__year', + -- 'user__ds_partitioned__extract_year', + -- 'user__ds_partitioned__extract_quarter', + -- 'user__ds_partitioned__extract_month', + -- 'user__ds_partitioned__extract_day', + -- 'user__ds_partitioned__extract_dow', + -- 'user__ds_partitioned__extract_doy', + -- 'user__last_profile_edit_ts__millisecond', + -- 'user__last_profile_edit_ts__second', + -- 'user__last_profile_edit_ts__minute', + -- 'user__last_profile_edit_ts__hour', + -- 'user__last_profile_edit_ts__day', + -- 'user__last_profile_edit_ts__week', + -- 'user__last_profile_edit_ts__month', + -- 'user__last_profile_edit_ts__quarter', + -- 'user__last_profile_edit_ts__year', + -- 'user__last_profile_edit_ts__extract_year', + -- 'user__last_profile_edit_ts__extract_quarter', + -- 'user__last_profile_edit_ts__extract_month', + -- 'user__last_profile_edit_ts__extract_day', + -- 'user__last_profile_edit_ts__extract_dow', + -- 'user__last_profile_edit_ts__extract_doy', + -- 'user__bio_added_ts__second', + -- 'user__bio_added_ts__minute', + -- 'user__bio_added_ts__hour', + -- 'user__bio_added_ts__day', + -- 'user__bio_added_ts__week', + -- 'user__bio_added_ts__month', + -- 'user__bio_added_ts__quarter', + -- 'user__bio_added_ts__year', + -- 'user__bio_added_ts__extract_year', + -- 'user__bio_added_ts__extract_quarter', + -- 'user__bio_added_ts__extract_month', + -- 'user__bio_added_ts__extract_day', + -- 'user__bio_added_ts__extract_dow', + -- 'user__bio_added_ts__extract_doy', + -- 'user__last_login_ts__minute', + -- 'user__last_login_ts__hour', + -- 'user__last_login_ts__day', + -- 'user__last_login_ts__week', + -- 'user__last_login_ts__month', + -- 'user__last_login_ts__quarter', + -- 'user__last_login_ts__year', + -- 'user__last_login_ts__extract_year', + -- 'user__last_login_ts__extract_quarter', + -- 'user__last_login_ts__extract_month', + -- 'user__last_login_ts__extract_day', + -- 'user__last_login_ts__extract_dow', + -- 'user__last_login_ts__extract_doy', + -- 'user__archived_at__hour', + -- 'user__archived_at__day', + -- 'user__archived_at__week', + -- 'user__archived_at__month', + -- 'user__archived_at__quarter', + -- 'user__archived_at__year', + -- 'user__archived_at__extract_year', + -- 'user__archived_at__extract_quarter', + -- 'user__archived_at__extract_month', + -- 'user__archived_at__extract_day', + -- 'user__archived_at__extract_dow', + -- 'user__archived_at__extract_doy', + -- 'metric_time__day', + -- 'metric_time__week', + -- 'metric_time__month', + -- 'metric_time__quarter', + -- 'metric_time__year', + -- 'metric_time__extract_year', + -- 'metric_time__extract_quarter', + -- 'metric_time__extract_month', + -- 'metric_time__extract_day', + -- 'metric_time__extract_dow', + -- 'metric_time__extract_doy', + -- 'user', + -- ] + SELECT + subq_6.ds__day + , subq_6.ds__week + , subq_6.ds__month + , subq_6.ds__quarter + , subq_6.ds__year + , subq_6.ds__extract_year + , subq_6.ds__extract_quarter + , subq_6.ds__extract_month + , subq_6.ds__extract_day + , subq_6.ds__extract_dow + , subq_6.ds__extract_doy + , subq_6.created_at__day + , subq_6.created_at__week + , subq_6.created_at__month + , subq_6.created_at__quarter + , subq_6.created_at__year + , subq_6.created_at__extract_year + , subq_6.created_at__extract_quarter + , subq_6.created_at__extract_month + , subq_6.created_at__extract_day + , subq_6.created_at__extract_dow + , subq_6.created_at__extract_doy + , subq_6.ds_partitioned__day + , subq_6.ds_partitioned__week + , subq_6.ds_partitioned__month + , subq_6.ds_partitioned__quarter + , subq_6.ds_partitioned__year + , subq_6.ds_partitioned__extract_year + , subq_6.ds_partitioned__extract_quarter + , subq_6.ds_partitioned__extract_month + , subq_6.ds_partitioned__extract_day + , subq_6.ds_partitioned__extract_dow + , subq_6.ds_partitioned__extract_doy + , subq_6.last_profile_edit_ts__millisecond + , subq_6.last_profile_edit_ts__second + , subq_6.last_profile_edit_ts__minute + , subq_6.last_profile_edit_ts__hour + , subq_6.last_profile_edit_ts__day + , subq_6.last_profile_edit_ts__week + , subq_6.last_profile_edit_ts__month + , subq_6.last_profile_edit_ts__quarter + , subq_6.last_profile_edit_ts__year + , subq_6.last_profile_edit_ts__extract_year + , subq_6.last_profile_edit_ts__extract_quarter + , subq_6.last_profile_edit_ts__extract_month + , subq_6.last_profile_edit_ts__extract_day + , subq_6.last_profile_edit_ts__extract_dow + , subq_6.last_profile_edit_ts__extract_doy + , subq_6.bio_added_ts__second + , subq_6.bio_added_ts__minute + , subq_6.bio_added_ts__hour + , subq_6.bio_added_ts__day + , subq_6.bio_added_ts__week + , subq_6.bio_added_ts__month + , subq_6.bio_added_ts__quarter + , subq_6.bio_added_ts__year + , subq_6.bio_added_ts__extract_year + , subq_6.bio_added_ts__extract_quarter + , subq_6.bio_added_ts__extract_month + , subq_6.bio_added_ts__extract_day + , subq_6.bio_added_ts__extract_dow + , subq_6.bio_added_ts__extract_doy + , subq_6.last_login_ts__minute + , subq_6.last_login_ts__hour + , subq_6.last_login_ts__day + , subq_6.last_login_ts__week + , subq_6.last_login_ts__month + , subq_6.last_login_ts__quarter + , subq_6.last_login_ts__year + , subq_6.last_login_ts__extract_year + , subq_6.last_login_ts__extract_quarter + , subq_6.last_login_ts__extract_month + , subq_6.last_login_ts__extract_day + , subq_6.last_login_ts__extract_dow + , subq_6.last_login_ts__extract_doy + , subq_6.archived_at__hour + , subq_6.archived_at__day + , subq_6.archived_at__week + , subq_6.archived_at__month + , subq_6.archived_at__quarter + , subq_6.archived_at__year + , subq_6.archived_at__extract_year + , subq_6.archived_at__extract_quarter + , subq_6.archived_at__extract_month + , subq_6.archived_at__extract_day + , subq_6.archived_at__extract_dow + , subq_6.archived_at__extract_doy + , subq_6.user__ds__day + , subq_6.user__ds__week + , subq_6.user__ds__month + , subq_6.user__ds__quarter + , subq_6.user__ds__year + , subq_6.user__ds__extract_year + , subq_6.user__ds__extract_quarter + , subq_6.user__ds__extract_month + , subq_6.user__ds__extract_day + , subq_6.user__ds__extract_dow + , subq_6.user__ds__extract_doy + , subq_6.user__created_at__day + , subq_6.user__created_at__week + , subq_6.user__created_at__month + , subq_6.user__created_at__quarter + , subq_6.user__created_at__year + , subq_6.user__created_at__extract_year + , subq_6.user__created_at__extract_quarter + , subq_6.user__created_at__extract_month + , subq_6.user__created_at__extract_day + , subq_6.user__created_at__extract_dow + , subq_6.user__created_at__extract_doy + , subq_6.user__ds_partitioned__day + , subq_6.user__ds_partitioned__week + , subq_6.user__ds_partitioned__month + , subq_6.user__ds_partitioned__quarter + , subq_6.user__ds_partitioned__year + , subq_6.user__ds_partitioned__extract_year + , subq_6.user__ds_partitioned__extract_quarter + , subq_6.user__ds_partitioned__extract_month + , subq_6.user__ds_partitioned__extract_day + , subq_6.user__ds_partitioned__extract_dow + , subq_6.user__ds_partitioned__extract_doy + , subq_6.user__last_profile_edit_ts__millisecond + , subq_6.user__last_profile_edit_ts__second + , subq_6.user__last_profile_edit_ts__minute + , subq_6.user__last_profile_edit_ts__hour + , subq_6.user__last_profile_edit_ts__day + , subq_6.user__last_profile_edit_ts__week + , subq_6.user__last_profile_edit_ts__month + , subq_6.user__last_profile_edit_ts__quarter + , subq_6.user__last_profile_edit_ts__year + , subq_6.user__last_profile_edit_ts__extract_year + , subq_6.user__last_profile_edit_ts__extract_quarter + , subq_6.user__last_profile_edit_ts__extract_month + , subq_6.user__last_profile_edit_ts__extract_day + , subq_6.user__last_profile_edit_ts__extract_dow + , subq_6.user__last_profile_edit_ts__extract_doy + , subq_6.user__bio_added_ts__second + , subq_6.user__bio_added_ts__minute + , subq_6.user__bio_added_ts__hour + , subq_6.user__bio_added_ts__day + , subq_6.user__bio_added_ts__week + , subq_6.user__bio_added_ts__month + , subq_6.user__bio_added_ts__quarter + , subq_6.user__bio_added_ts__year + , subq_6.user__bio_added_ts__extract_year + , subq_6.user__bio_added_ts__extract_quarter + , subq_6.user__bio_added_ts__extract_month + , subq_6.user__bio_added_ts__extract_day + , subq_6.user__bio_added_ts__extract_dow + , subq_6.user__bio_added_ts__extract_doy + , subq_6.user__last_login_ts__minute + , subq_6.user__last_login_ts__hour + , subq_6.user__last_login_ts__day + , subq_6.user__last_login_ts__week + , subq_6.user__last_login_ts__month + , subq_6.user__last_login_ts__quarter + , subq_6.user__last_login_ts__year + , subq_6.user__last_login_ts__extract_year + , subq_6.user__last_login_ts__extract_quarter + , subq_6.user__last_login_ts__extract_month + , subq_6.user__last_login_ts__extract_day + , subq_6.user__last_login_ts__extract_dow + , subq_6.user__last_login_ts__extract_doy + , subq_6.user__archived_at__hour + , subq_6.user__archived_at__day + , subq_6.user__archived_at__week + , subq_6.user__archived_at__month + , subq_6.user__archived_at__quarter + , subq_6.user__archived_at__year + , subq_6.user__archived_at__extract_year + , subq_6.user__archived_at__extract_quarter + , subq_6.user__archived_at__extract_month + , subq_6.user__archived_at__extract_day + , subq_6.user__archived_at__extract_dow + , subq_6.user__archived_at__extract_doy + , subq_6.metric_time__day + , subq_6.metric_time__week + , subq_6.metric_time__month + , subq_6.metric_time__quarter + , subq_6.metric_time__year + , subq_6.metric_time__extract_year + , subq_6.metric_time__extract_quarter + , subq_6.metric_time__extract_month + , subq_6.metric_time__extract_day + , subq_6.metric_time__extract_dow + , subq_6.metric_time__extract_doy + , subq_6.user + , subq_6.home_state + , subq_6.user__home_state + FROM ( + -- Metric Time Dimension 'created_at' + SELECT + subq_5.ds__day + , subq_5.ds__week + , subq_5.ds__month + , subq_5.ds__quarter + , subq_5.ds__year + , subq_5.ds__extract_year + , subq_5.ds__extract_quarter + , subq_5.ds__extract_month + , subq_5.ds__extract_day + , subq_5.ds__extract_dow + , subq_5.ds__extract_doy + , subq_5.created_at__day + , subq_5.created_at__week + , subq_5.created_at__month + , subq_5.created_at__quarter + , subq_5.created_at__year + , subq_5.created_at__extract_year + , subq_5.created_at__extract_quarter + , subq_5.created_at__extract_month + , subq_5.created_at__extract_day + , subq_5.created_at__extract_dow + , subq_5.created_at__extract_doy + , subq_5.ds_partitioned__day + , subq_5.ds_partitioned__week + , subq_5.ds_partitioned__month + , subq_5.ds_partitioned__quarter + , subq_5.ds_partitioned__year + , subq_5.ds_partitioned__extract_year + , subq_5.ds_partitioned__extract_quarter + , subq_5.ds_partitioned__extract_month + , subq_5.ds_partitioned__extract_day + , subq_5.ds_partitioned__extract_dow + , subq_5.ds_partitioned__extract_doy + , subq_5.last_profile_edit_ts__millisecond + , subq_5.last_profile_edit_ts__second + , subq_5.last_profile_edit_ts__minute + , subq_5.last_profile_edit_ts__hour + , subq_5.last_profile_edit_ts__day + , subq_5.last_profile_edit_ts__week + , subq_5.last_profile_edit_ts__month + , subq_5.last_profile_edit_ts__quarter + , subq_5.last_profile_edit_ts__year + , subq_5.last_profile_edit_ts__extract_year + , subq_5.last_profile_edit_ts__extract_quarter + , subq_5.last_profile_edit_ts__extract_month + , subq_5.last_profile_edit_ts__extract_day + , subq_5.last_profile_edit_ts__extract_dow + , subq_5.last_profile_edit_ts__extract_doy + , subq_5.bio_added_ts__second + , subq_5.bio_added_ts__minute + , subq_5.bio_added_ts__hour + , subq_5.bio_added_ts__day + , subq_5.bio_added_ts__week + , subq_5.bio_added_ts__month + , subq_5.bio_added_ts__quarter + , subq_5.bio_added_ts__year + , subq_5.bio_added_ts__extract_year + , subq_5.bio_added_ts__extract_quarter + , subq_5.bio_added_ts__extract_month + , subq_5.bio_added_ts__extract_day + , subq_5.bio_added_ts__extract_dow + , subq_5.bio_added_ts__extract_doy + , subq_5.last_login_ts__minute + , subq_5.last_login_ts__hour + , subq_5.last_login_ts__day + , subq_5.last_login_ts__week + , subq_5.last_login_ts__month + , subq_5.last_login_ts__quarter + , subq_5.last_login_ts__year + , subq_5.last_login_ts__extract_year + , subq_5.last_login_ts__extract_quarter + , subq_5.last_login_ts__extract_month + , subq_5.last_login_ts__extract_day + , subq_5.last_login_ts__extract_dow + , subq_5.last_login_ts__extract_doy + , subq_5.archived_at__hour + , subq_5.archived_at__day + , subq_5.archived_at__week + , subq_5.archived_at__month + , subq_5.archived_at__quarter + , subq_5.archived_at__year + , subq_5.archived_at__extract_year + , subq_5.archived_at__extract_quarter + , subq_5.archived_at__extract_month + , subq_5.archived_at__extract_day + , subq_5.archived_at__extract_dow + , subq_5.archived_at__extract_doy + , subq_5.user__ds__day + , subq_5.user__ds__week + , subq_5.user__ds__month + , subq_5.user__ds__quarter + , subq_5.user__ds__year + , subq_5.user__ds__extract_year + , subq_5.user__ds__extract_quarter + , subq_5.user__ds__extract_month + , subq_5.user__ds__extract_day + , subq_5.user__ds__extract_dow + , subq_5.user__ds__extract_doy + , subq_5.user__created_at__day + , subq_5.user__created_at__week + , subq_5.user__created_at__month + , subq_5.user__created_at__quarter + , subq_5.user__created_at__year + , subq_5.user__created_at__extract_year + , subq_5.user__created_at__extract_quarter + , subq_5.user__created_at__extract_month + , subq_5.user__created_at__extract_day + , subq_5.user__created_at__extract_dow + , subq_5.user__created_at__extract_doy + , subq_5.user__ds_partitioned__day + , subq_5.user__ds_partitioned__week + , subq_5.user__ds_partitioned__month + , subq_5.user__ds_partitioned__quarter + , subq_5.user__ds_partitioned__year + , subq_5.user__ds_partitioned__extract_year + , subq_5.user__ds_partitioned__extract_quarter + , subq_5.user__ds_partitioned__extract_month + , subq_5.user__ds_partitioned__extract_day + , subq_5.user__ds_partitioned__extract_dow + , subq_5.user__ds_partitioned__extract_doy + , subq_5.user__last_profile_edit_ts__millisecond + , subq_5.user__last_profile_edit_ts__second + , subq_5.user__last_profile_edit_ts__minute + , subq_5.user__last_profile_edit_ts__hour + , subq_5.user__last_profile_edit_ts__day + , subq_5.user__last_profile_edit_ts__week + , subq_5.user__last_profile_edit_ts__month + , subq_5.user__last_profile_edit_ts__quarter + , subq_5.user__last_profile_edit_ts__year + , subq_5.user__last_profile_edit_ts__extract_year + , subq_5.user__last_profile_edit_ts__extract_quarter + , subq_5.user__last_profile_edit_ts__extract_month + , subq_5.user__last_profile_edit_ts__extract_day + , subq_5.user__last_profile_edit_ts__extract_dow + , subq_5.user__last_profile_edit_ts__extract_doy + , subq_5.user__bio_added_ts__second + , subq_5.user__bio_added_ts__minute + , subq_5.user__bio_added_ts__hour + , subq_5.user__bio_added_ts__day + , subq_5.user__bio_added_ts__week + , subq_5.user__bio_added_ts__month + , subq_5.user__bio_added_ts__quarter + , subq_5.user__bio_added_ts__year + , subq_5.user__bio_added_ts__extract_year + , subq_5.user__bio_added_ts__extract_quarter + , subq_5.user__bio_added_ts__extract_month + , subq_5.user__bio_added_ts__extract_day + , subq_5.user__bio_added_ts__extract_dow + , subq_5.user__bio_added_ts__extract_doy + , subq_5.user__last_login_ts__minute + , subq_5.user__last_login_ts__hour + , subq_5.user__last_login_ts__day + , subq_5.user__last_login_ts__week + , subq_5.user__last_login_ts__month + , subq_5.user__last_login_ts__quarter + , subq_5.user__last_login_ts__year + , subq_5.user__last_login_ts__extract_year + , subq_5.user__last_login_ts__extract_quarter + , subq_5.user__last_login_ts__extract_month + , subq_5.user__last_login_ts__extract_day + , subq_5.user__last_login_ts__extract_dow + , subq_5.user__last_login_ts__extract_doy + , subq_5.user__archived_at__hour + , subq_5.user__archived_at__day + , subq_5.user__archived_at__week + , subq_5.user__archived_at__month + , subq_5.user__archived_at__quarter + , subq_5.user__archived_at__year + , subq_5.user__archived_at__extract_year + , subq_5.user__archived_at__extract_quarter + , subq_5.user__archived_at__extract_month + , subq_5.user__archived_at__extract_day + , subq_5.user__archived_at__extract_dow + , subq_5.user__archived_at__extract_doy + , subq_5.created_at__day AS metric_time__day + , subq_5.created_at__week AS metric_time__week + , subq_5.created_at__month AS metric_time__month + , subq_5.created_at__quarter AS metric_time__quarter + , subq_5.created_at__year AS metric_time__year + , subq_5.created_at__extract_year AS metric_time__extract_year + , subq_5.created_at__extract_quarter AS metric_time__extract_quarter + , subq_5.created_at__extract_month AS metric_time__extract_month + , subq_5.created_at__extract_day AS metric_time__extract_day + , subq_5.created_at__extract_dow AS metric_time__extract_dow + , subq_5.created_at__extract_doy AS metric_time__extract_doy + , subq_5.user + , subq_5.home_state + , subq_5.user__home_state + , subq_5.new_users + FROM ( + -- Read Elements From Semantic Model 'users_ds_source' + SELECT + 1 AS new_users + , 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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_5 + ) subq_6 + ) subq_7 + ON + subq_4.user = subq_7.user + ) subq_8 + ) subq_9 + ON + ( + subq_2.listing = subq_9.listing + ) AND ( + subq_2.ds_partitioned__day = subq_9.user__ds_partitioned__day + ) + ) subq_10 + ) subq_11 + GROUP BY + subq_11.listing__user__bio_added_ts__minute +) subq_12 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql new file mode 100644 index 0000000000..d93a3918ba --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_metric_with_joined_sub_daily_dimension__plan0_optimized.sql @@ -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 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_metric_with_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_metric_with_sub_daily_dimension__plan0.sql new file mode 100644 index 0000000000..c5e5638664 --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_metric_with_sub_daily_dimension__plan0.sql @@ -0,0 +1,394 @@ +-- Compute Metrics via Expressions +SELECT + subq_3.user__archived_at__hour + , subq_3.new_users +FROM ( + -- Aggregate Measures + SELECT + subq_2.user__archived_at__hour + , SUM(subq_2.new_users) AS new_users + FROM ( + -- Pass Only Elements: ['new_users', 'user__archived_at__hour'] + SELECT + subq_1.user__archived_at__hour + , subq_1.new_users + FROM ( + -- Metric Time Dimension 'created_at' + SELECT + subq_0.ds__day + , subq_0.ds__week + , subq_0.ds__month + , subq_0.ds__quarter + , subq_0.ds__year + , subq_0.ds__extract_year + , subq_0.ds__extract_quarter + , subq_0.ds__extract_month + , subq_0.ds__extract_day + , subq_0.ds__extract_dow + , subq_0.ds__extract_doy + , subq_0.created_at__day + , subq_0.created_at__week + , subq_0.created_at__month + , subq_0.created_at__quarter + , subq_0.created_at__year + , subq_0.created_at__extract_year + , subq_0.created_at__extract_quarter + , subq_0.created_at__extract_month + , subq_0.created_at__extract_day + , subq_0.created_at__extract_dow + , subq_0.created_at__extract_doy + , subq_0.ds_partitioned__day + , subq_0.ds_partitioned__week + , subq_0.ds_partitioned__month + , subq_0.ds_partitioned__quarter + , subq_0.ds_partitioned__year + , subq_0.ds_partitioned__extract_year + , subq_0.ds_partitioned__extract_quarter + , subq_0.ds_partitioned__extract_month + , subq_0.ds_partitioned__extract_day + , subq_0.ds_partitioned__extract_dow + , subq_0.ds_partitioned__extract_doy + , subq_0.last_profile_edit_ts__millisecond + , subq_0.last_profile_edit_ts__second + , subq_0.last_profile_edit_ts__minute + , subq_0.last_profile_edit_ts__hour + , subq_0.last_profile_edit_ts__day + , subq_0.last_profile_edit_ts__week + , subq_0.last_profile_edit_ts__month + , subq_0.last_profile_edit_ts__quarter + , subq_0.last_profile_edit_ts__year + , subq_0.last_profile_edit_ts__extract_year + , subq_0.last_profile_edit_ts__extract_quarter + , subq_0.last_profile_edit_ts__extract_month + , subq_0.last_profile_edit_ts__extract_day + , subq_0.last_profile_edit_ts__extract_dow + , subq_0.last_profile_edit_ts__extract_doy + , subq_0.bio_added_ts__second + , subq_0.bio_added_ts__minute + , subq_0.bio_added_ts__hour + , subq_0.bio_added_ts__day + , subq_0.bio_added_ts__week + , subq_0.bio_added_ts__month + , subq_0.bio_added_ts__quarter + , subq_0.bio_added_ts__year + , subq_0.bio_added_ts__extract_year + , subq_0.bio_added_ts__extract_quarter + , subq_0.bio_added_ts__extract_month + , subq_0.bio_added_ts__extract_day + , subq_0.bio_added_ts__extract_dow + , subq_0.bio_added_ts__extract_doy + , subq_0.last_login_ts__minute + , subq_0.last_login_ts__hour + , subq_0.last_login_ts__day + , subq_0.last_login_ts__week + , subq_0.last_login_ts__month + , subq_0.last_login_ts__quarter + , subq_0.last_login_ts__year + , subq_0.last_login_ts__extract_year + , subq_0.last_login_ts__extract_quarter + , subq_0.last_login_ts__extract_month + , subq_0.last_login_ts__extract_day + , subq_0.last_login_ts__extract_dow + , subq_0.last_login_ts__extract_doy + , subq_0.archived_at__hour + , subq_0.archived_at__day + , subq_0.archived_at__week + , subq_0.archived_at__month + , subq_0.archived_at__quarter + , subq_0.archived_at__year + , subq_0.archived_at__extract_year + , subq_0.archived_at__extract_quarter + , subq_0.archived_at__extract_month + , subq_0.archived_at__extract_day + , subq_0.archived_at__extract_dow + , subq_0.archived_at__extract_doy + , subq_0.user__ds__day + , subq_0.user__ds__week + , subq_0.user__ds__month + , subq_0.user__ds__quarter + , subq_0.user__ds__year + , subq_0.user__ds__extract_year + , subq_0.user__ds__extract_quarter + , subq_0.user__ds__extract_month + , subq_0.user__ds__extract_day + , subq_0.user__ds__extract_dow + , subq_0.user__ds__extract_doy + , subq_0.user__created_at__day + , subq_0.user__created_at__week + , subq_0.user__created_at__month + , subq_0.user__created_at__quarter + , subq_0.user__created_at__year + , subq_0.user__created_at__extract_year + , subq_0.user__created_at__extract_quarter + , subq_0.user__created_at__extract_month + , subq_0.user__created_at__extract_day + , subq_0.user__created_at__extract_dow + , subq_0.user__created_at__extract_doy + , subq_0.user__ds_partitioned__day + , subq_0.user__ds_partitioned__week + , subq_0.user__ds_partitioned__month + , subq_0.user__ds_partitioned__quarter + , subq_0.user__ds_partitioned__year + , subq_0.user__ds_partitioned__extract_year + , subq_0.user__ds_partitioned__extract_quarter + , subq_0.user__ds_partitioned__extract_month + , subq_0.user__ds_partitioned__extract_day + , subq_0.user__ds_partitioned__extract_dow + , subq_0.user__ds_partitioned__extract_doy + , subq_0.user__last_profile_edit_ts__millisecond + , subq_0.user__last_profile_edit_ts__second + , subq_0.user__last_profile_edit_ts__minute + , subq_0.user__last_profile_edit_ts__hour + , subq_0.user__last_profile_edit_ts__day + , subq_0.user__last_profile_edit_ts__week + , subq_0.user__last_profile_edit_ts__month + , subq_0.user__last_profile_edit_ts__quarter + , subq_0.user__last_profile_edit_ts__year + , subq_0.user__last_profile_edit_ts__extract_year + , subq_0.user__last_profile_edit_ts__extract_quarter + , subq_0.user__last_profile_edit_ts__extract_month + , subq_0.user__last_profile_edit_ts__extract_day + , subq_0.user__last_profile_edit_ts__extract_dow + , subq_0.user__last_profile_edit_ts__extract_doy + , subq_0.user__bio_added_ts__second + , subq_0.user__bio_added_ts__minute + , subq_0.user__bio_added_ts__hour + , subq_0.user__bio_added_ts__day + , subq_0.user__bio_added_ts__week + , subq_0.user__bio_added_ts__month + , subq_0.user__bio_added_ts__quarter + , subq_0.user__bio_added_ts__year + , subq_0.user__bio_added_ts__extract_year + , subq_0.user__bio_added_ts__extract_quarter + , subq_0.user__bio_added_ts__extract_month + , subq_0.user__bio_added_ts__extract_day + , subq_0.user__bio_added_ts__extract_dow + , subq_0.user__bio_added_ts__extract_doy + , subq_0.user__last_login_ts__minute + , subq_0.user__last_login_ts__hour + , subq_0.user__last_login_ts__day + , subq_0.user__last_login_ts__week + , subq_0.user__last_login_ts__month + , subq_0.user__last_login_ts__quarter + , subq_0.user__last_login_ts__year + , subq_0.user__last_login_ts__extract_year + , subq_0.user__last_login_ts__extract_quarter + , subq_0.user__last_login_ts__extract_month + , subq_0.user__last_login_ts__extract_day + , subq_0.user__last_login_ts__extract_dow + , subq_0.user__last_login_ts__extract_doy + , subq_0.user__archived_at__hour + , subq_0.user__archived_at__day + , subq_0.user__archived_at__week + , subq_0.user__archived_at__month + , subq_0.user__archived_at__quarter + , subq_0.user__archived_at__year + , subq_0.user__archived_at__extract_year + , subq_0.user__archived_at__extract_quarter + , subq_0.user__archived_at__extract_month + , subq_0.user__archived_at__extract_day + , subq_0.user__archived_at__extract_dow + , subq_0.user__archived_at__extract_doy + , subq_0.created_at__day AS metric_time__day + , subq_0.created_at__week AS metric_time__week + , subq_0.created_at__month AS metric_time__month + , subq_0.created_at__quarter AS metric_time__quarter + , subq_0.created_at__year AS metric_time__year + , subq_0.created_at__extract_year AS metric_time__extract_year + , subq_0.created_at__extract_quarter AS metric_time__extract_quarter + , subq_0.created_at__extract_month AS metric_time__extract_month + , subq_0.created_at__extract_day AS metric_time__extract_day + , subq_0.created_at__extract_dow AS metric_time__extract_dow + , subq_0.created_at__extract_doy AS metric_time__extract_doy + , subq_0.user + , subq_0.home_state + , subq_0.user__home_state + , subq_0.new_users + FROM ( + -- Read Elements From Semantic Model 'users_ds_source' + SELECT + 1 AS new_users + , 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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(DAY_OF_WEEK 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 + ) subq_1 + ) subq_2 + GROUP BY + subq_2.user__archived_at__hour +) subq_3 diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql new file mode 100644 index 0000000000..c20146c881 --- /dev/null +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_simple_metric_with_sub_daily_dimension__plan0_optimized.sql @@ -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 + DATE_TRUNC('hour', archived_at) 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