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