diff --git a/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/partitioned_multi_hop_join_manifest/bridge_table.yaml b/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/partitioned_multi_hop_join_manifest/bridge_table.yaml
index 3f804148fb..c131de2268 100644
--- a/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/partitioned_multi_hop_join_manifest/bridge_table.yaml
+++ b/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/partitioned_multi_hop_join_manifest/bridge_table.yaml
@@ -7,6 +7,15 @@ semantic_model:
schema_name: $source_schema
alias: bridge_table
+ defaults:
+ agg_time_dimension: ds_partitioned
+
+ measures:
+ - name: account_customer_combos
+ expr: account_id || customer_id
+ agg: count_distinct
+ create_metric: true
+
dimensions:
- name: extra_dim
type: categorical
diff --git a/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/partitioned_multi_hop_join_manifest/customer_other_data.yaml b/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/partitioned_multi_hop_join_manifest/customer_other_data.yaml
index e99258fa6a..d1435446bc 100644
--- a/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/partitioned_multi_hop_join_manifest/customer_other_data.yaml
+++ b/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/partitioned_multi_hop_join_manifest/customer_other_data.yaml
@@ -7,9 +7,21 @@ semantic_model:
schema_name: $source_schema
alias: customer_other_data
+ defaults:
+ agg_time_dimension: acquired_ds
+
+ measures:
+ - name: customers_with_other_data
+ expr: 1
+ agg: sum
+
dimensions:
- name: country
type: categorical
+ - name: acquired_ds
+ type: time
+ type_params:
+ time_granularity: day
entities:
- name: customer_id
diff --git a/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/partitioned_multi_hop_join_manifest/customer_table.yaml b/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/partitioned_multi_hop_join_manifest/customer_table.yaml
index 13ff17e26e..c2f6b4805e 100644
--- a/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/partitioned_multi_hop_join_manifest/customer_table.yaml
+++ b/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/partitioned_multi_hop_join_manifest/customer_table.yaml
@@ -7,6 +7,16 @@ semantic_model:
schema_name: $source_schema
alias: customer_table
+
+ defaults:
+ agg_time_dimension: ds_partitioned
+
+ measures:
+ - name: customers
+ expr: 1
+ agg: sum
+ create_metric: true
+
dimensions:
- name: customer_name
type: categorical
diff --git a/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/partitioned_multi_hop_join_manifest/metrics.yaml b/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/partitioned_multi_hop_join_manifest/metrics.yaml
new file mode 100644
index 0000000000..d9fd8ab009
--- /dev/null
+++ b/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/partitioned_multi_hop_join_manifest/metrics.yaml
@@ -0,0 +1,8 @@
+---
+metric:
+ name: paraguayan_customers
+ type: SIMPLE
+ type_params:
+ measure: customers_with_other_data
+ filter: |
+ {{ Dimension('customer_id__country') }} = 'paraguay'
diff --git a/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/partitioned_multi_hop_join_manifest/third_hop_table.yaml b/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/partitioned_multi_hop_join_manifest/third_hop_table.yaml
index 5051f263bb..b808e6e71b 100644
--- a/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/partitioned_multi_hop_join_manifest/third_hop_table.yaml
+++ b/metricflow-semantics/metricflow_semantics/test_helpers/semantic_manifest_yamls/partitioned_multi_hop_join_manifest/third_hop_table.yaml
@@ -7,9 +7,22 @@ semantic_model:
schema_name: $source_schema
alias: third_hop_table
+ defaults:
+ agg_time_dimension: third_hop_ds
+
+ measures:
+ - name: third_hop_count
+ expr: customer_third_hop_id
+ agg: count_distinct
+ create_metric: true
+
dimensions:
- name: value
type: categorical
+ - name: third_hop_ds
+ type: time
+ type_params:
+ time_granularity: day
entities:
- name: customer_third_hop_id
diff --git a/tests_metricflow/fixtures/dataflow_fixtures.py b/tests_metricflow/fixtures/dataflow_fixtures.py
index 540065b162..5ce317989c 100644
--- a/tests_metricflow/fixtures/dataflow_fixtures.py
+++ b/tests_metricflow/fixtures/dataflow_fixtures.py
@@ -60,6 +60,13 @@ def multihop_dataflow_plan_builder( # noqa: D103
].dataflow_plan_builder
+@pytest.fixture(scope="session")
+def multihop_query_parser( # noqa: D103
+ mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture]
+) -> MetricFlowQueryParser:
+ return mf_engine_test_fixture_mapping[SemanticManifestSetup.PARTITIONED_MULTI_HOP_JOIN_MANIFEST].query_parser
+
+
@pytest.fixture(scope="session")
def scd_column_association_resolver( # noqa: D103
mf_engine_test_fixture_mapping: Mapping[SemanticManifestSetup, MetricFlowEngineTestFixture]
diff --git a/tests_metricflow/fixtures/source_table_snapshots/multi_hop_join_model/customer_other_data.yaml b/tests_metricflow/fixtures/source_table_snapshots/multi_hop_join_model/customer_other_data.yaml
index 69dbb7a0c2..09ecde7bf2 100644
--- a/tests_metricflow/fixtures/source_table_snapshots/multi_hop_join_model/customer_other_data.yaml
+++ b/tests_metricflow/fixtures/source_table_snapshots/multi_hop_join_model/customer_other_data.yaml
@@ -7,8 +7,10 @@ table_snapshot:
type: STRING
- name: customer_third_hop_id
type: STRING
+ - name: acquired_ds
+ type: STRING
rows:
- - ["0", "turkmenistan", "another_id0"]
- - ["1", "paraguay", "another_id1"]
- - ["2", "myanmar", "another_id2"]
- - ["3", "djibouti", "another_id3"]
+ - ["0", "turkmenistan", "another_id0", "2020-01-01"]
+ - ["1", "paraguay", "another_id1", "2020-01-02"]
+ - ["2", "myanmar", "another_id2", "2020-01-03"]
+ - ["3", "djibouti", "another_id3", "2020-01-04"]
diff --git a/tests_metricflow/fixtures/source_table_snapshots/multi_hop_join_model/third_hop_table.yaml b/tests_metricflow/fixtures/source_table_snapshots/multi_hop_join_model/third_hop_table.yaml
index d90370db61..6d8d31eea5 100644
--- a/tests_metricflow/fixtures/source_table_snapshots/multi_hop_join_model/third_hop_table.yaml
+++ b/tests_metricflow/fixtures/source_table_snapshots/multi_hop_join_model/third_hop_table.yaml
@@ -5,8 +5,10 @@ table_snapshot:
type: STRING
- name: value
type: STRING
+ - name: third_hop_ds
+ type: STRING
rows:
- - ["another_id0", "citadel"]
- - ["another_id1", "virtu"]
- - ["another_id2", "two sigma"]
- - ["another_id3", "jump"]
+ - ["another_id0", "citadel", "2020-01-01"]
+ - ["another_id1", "virtu", "2020-01-02"]
+ - ["another_id2", "two sigma", "2020-01-03"]
+ - ["another_id3", "jump", "2020-01-04"]
diff --git a/tests_metricflow/integration/test_cases/itest_metrics.yaml b/tests_metricflow/integration/test_cases/itest_metrics.yaml
index a288d62a43..84b45fbec0 100644
--- a/tests_metricflow/integration/test_cases/itest_metrics.yaml
+++ b/tests_metricflow/integration/test_cases/itest_metrics.yaml
@@ -2086,3 +2086,48 @@ integration_test:
) metric_subquery
ON l.listing_id = metric_subquery.listing_id
WHERE views > 10
+---
+integration_test:
+ name: test_metric_filter_with_inner_query_single_hop_join
+ description: Query with a metric filter where the inner query uses a single-hop join
+ model: PARTITIONED_MULTI_HOP_JOIN_MODEL
+ metrics: ["third_hop_count"]
+ where_filter: "{{ render_metric_template('paraguayan_customers', ['customer_third_hop_id']) }} > 0"
+ check_query: |
+ SELECT
+ COUNT(DISTINCT t.customer_third_hop_id) AS third_hop_count
+ FROM {{ source_schema }}.third_hop_table t
+ LEFT OUTER JOIN (
+ SELECT
+ customer_third_hop_id
+ , SUM(1) AS paraguayan_customers
+ FROM {{ source_schema }}.customer_other_data c
+ WHERE country = 'paraguay'
+ GROUP BY customer_third_hop_id
+ ) metric_subquery
+ ON t.customer_third_hop_id = metric_subquery.customer_third_hop_id
+ WHERE paraguayan_customers > 0
+---
+integration_test:
+ name: test_metric_filter_with_inner_query_multi_hop_join
+ description: Query with a metric filter where the inner query uses a two-hop join
+ model: PARTITIONED_MULTI_HOP_JOIN_MODEL
+ metrics: ["third_hop_count"]
+ where_filter: "{{ render_metric_template('txn_count', ['account_id__customer_id__customer_third_hop_id']) }} > 0"
+ check_query: |
+ SELECT
+ COUNT(DISTINCT t.customer_third_hop_id) AS third_hop_count
+ FROM {{ source_schema }}.third_hop_table t
+ LEFT OUTER JOIN (
+ SELECT
+ c.customer_third_hop_id
+ , SUM(a.txn_count) AS txn_count
+ FROM {{ source_schema }}.account_month_txns a
+ LEFT OUTER JOIN {{ source_schema }}.bridge_table b
+ ON (a.account_id = b.account_id) AND ({{ render_date_trunc("a.ds_partitioned", TimeGranularity.DAY) }} = {{ render_date_trunc("b.ds_partitioned", TimeGranularity.DAY) }})
+ LEFT OUTER JOIN {{ source_schema }}.customer_other_data c
+ ON b.customer_id = c.customer_id
+ GROUP BY c.customer_third_hop_id
+ ) metric_subquery
+ ON t.customer_third_hop_id = metric_subquery.customer_third_hop_id
+ WHERE txn_count > 0
diff --git a/tests_metricflow/populate_persistent_source_schemas.py b/tests_metricflow/populate_persistent_source_schemas.py
index 878e4ebb9f..b88248934d 100644
--- a/tests_metricflow/populate_persistent_source_schemas.py
+++ b/tests_metricflow/populate_persistent_source_schemas.py
@@ -36,7 +36,7 @@ def populate_schemas(test_configuration: MetricFlowTestConfiguration) -> None:
hatch_env = f"{engine_name}-env"
run_command(
f"hatch -v run {hatch_env}:pytest -vv --log-cli-level info --use-persistent-source-schema "
- "tests/source_schema_tools.py::populate_source_schema"
+ "tests_metricflow/source_schema_tools.py::populate_source_schema"
)
else:
assert_values_exhausted(test_configuration.engine)
diff --git a/tests_metricflow/query_rendering/test_metric_filter_rendering.py b/tests_metricflow/query_rendering/test_metric_filter_rendering.py
index 96f78e07dd..4a688910d5 100644
--- a/tests_metricflow/query_rendering/test_metric_filter_rendering.py
+++ b/tests_metricflow/query_rendering/test_metric_filter_rendering.py
@@ -306,3 +306,57 @@ def test_filter_with_conversion_metric( # noqa: D103
sql_client=sql_client,
node=dataflow_plan.sink_node,
)
+
+
+@pytest.mark.sql_engine_snapshot
+def test_inner_query_single_hop(
+ request: FixtureRequest,
+ mf_test_configuration: MetricFlowTestConfiguration,
+ multihop_dataflow_plan_builder: DataflowPlanBuilder,
+ sql_client: SqlClient,
+ multihop_dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter,
+ multihop_query_parser: MetricFlowQueryParser,
+) -> None:
+ """Tests rendering for a metric filter using a one-hop join in the inner query."""
+ query_spec = multihop_query_parser.parse_and_validate_query(
+ metric_names=("third_hop_count",),
+ where_constraint=PydanticWhereFilter(
+ where_sql_template="{{ Metric('paraguayan_customers', ['customer_id__customer_third_hop_id']) }} > 0",
+ ),
+ ).query_spec
+ dataflow_plan = multihop_dataflow_plan_builder.build_plan(query_spec)
+
+ convert_and_check(
+ request=request,
+ mf_test_configuration=mf_test_configuration,
+ dataflow_to_sql_converter=multihop_dataflow_to_sql_converter,
+ sql_client=sql_client,
+ node=dataflow_plan.sink_node,
+ )
+
+
+@pytest.mark.sql_engine_snapshot
+def test_inner_query_multi_hop(
+ request: FixtureRequest,
+ mf_test_configuration: MetricFlowTestConfiguration,
+ multihop_dataflow_plan_builder: DataflowPlanBuilder,
+ sql_client: SqlClient,
+ multihop_dataflow_to_sql_converter: DataflowToSqlQueryPlanConverter,
+ multihop_query_parser: MetricFlowQueryParser,
+) -> None:
+ """Tests rendering for a metric filter using a two-hop join in the inner query."""
+ query_spec = multihop_query_parser.parse_and_validate_query(
+ metric_names=("third_hop_count",),
+ where_constraint=PydanticWhereFilter(
+ where_sql_template="{{ Metric('txn_count', ['account_id__customer_id__customer_third_hop_id']) }} > 2",
+ ),
+ ).query_spec
+ dataflow_plan = multihop_dataflow_plan_builder.build_plan(query_spec)
+
+ convert_and_check(
+ request=request,
+ mf_test_configuration=mf_test_configuration,
+ dataflow_to_sql_converter=multihop_dataflow_to_sql_converter,
+ sql_client=sql_client,
+ node=dataflow_plan.sink_node,
+ )
diff --git a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multihop_join_plan__dfp_0.xml b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multihop_join_plan__dfp_0.xml
index 5f40f7ab69..2fd679eb48 100644
--- a/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multihop_join_plan__dfp_0.xml
+++ b/tests_metricflow/snapshots/test_dataflow_plan_builder.py/DataflowPlan/test_multihop_join_plan__dfp_0.xml
@@ -95,11 +95,16 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -129,6 +134,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -262,13 +278,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_multihop_joined_plan__ep_0.xml b/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_multihop_joined_plan__ep_0.xml
index ec3c5d3718..52203b0845 100644
--- a/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_multihop_joined_plan__ep_0.xml
+++ b/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_multihop_joined_plan__ep_0.xml
@@ -8,7 +8,7 @@
-
+
@@ -28,12 +28,12 @@
-
+
-
+
-
+
diff --git a/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_multihop_joined_plan__ep_0.xml b/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_multihop_joined_plan__ep_0.xml
index 50ce27348e..7b5757bb91 100644
--- a/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_multihop_joined_plan__ep_0.xml
+++ b/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_multihop_joined_plan__ep_0.xml
@@ -8,7 +8,7 @@
-
+
@@ -28,14 +28,14 @@
-
+
-
+
-
+
-
+
diff --git a/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_multihop_joined_plan__ep_0.xml b/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_multihop_joined_plan__ep_0.xml
index 50ce27348e..7b5757bb91 100644
--- a/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_multihop_joined_plan__ep_0.xml
+++ b/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_multihop_joined_plan__ep_0.xml
@@ -8,7 +8,7 @@
-
+
@@ -28,14 +28,14 @@
-
+
-
+
-
+
-
+
diff --git a/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_multihop_joined_plan__ep_0.xml b/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_multihop_joined_plan__ep_0.xml
index 50ce27348e..7b5757bb91 100644
--- a/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_multihop_joined_plan__ep_0.xml
+++ b/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_multihop_joined_plan__ep_0.xml
@@ -8,7 +8,7 @@
-
+
@@ -28,14 +28,14 @@
-
+
-
+
-
+
-
+
diff --git a/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_multihop_joined_plan__ep_0.xml b/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_multihop_joined_plan__ep_0.xml
index 50ce27348e..7b5757bb91 100644
--- a/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_multihop_joined_plan__ep_0.xml
+++ b/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_multihop_joined_plan__ep_0.xml
@@ -8,7 +8,7 @@
-
+
@@ -28,14 +28,14 @@
-
+
-
+
-
+
-
+
diff --git a/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_multihop_joined_plan__ep_0.xml b/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_multihop_joined_plan__ep_0.xml
index 50ce27348e..7b5757bb91 100644
--- a/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_multihop_joined_plan__ep_0.xml
+++ b/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_multihop_joined_plan__ep_0.xml
@@ -8,7 +8,7 @@
-
+
@@ -28,14 +28,14 @@
-
+
-
+
-
+
-
+
diff --git a/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_multihop_joined_plan__ep_0.xml b/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_multihop_joined_plan__ep_0.xml
index 50ce27348e..7b5757bb91 100644
--- a/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_multihop_joined_plan__ep_0.xml
+++ b/tests_metricflow/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_multihop_joined_plan__ep_0.xml
@@ -8,7 +8,7 @@
-
+
@@ -28,14 +28,14 @@
-
+
-
+
-
+
-
+
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_multi_hop__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_multi_hop__plan0.sql
new file mode 100644
index 0000000000..2cca68ca92
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_multi_hop__plan0.sql
@@ -0,0 +1,694 @@
+-- Compute Metrics via Expressions
+SELECT
+ subq_40.third_hop_count
+FROM (
+ -- Aggregate Measures
+ SELECT
+ COUNT(DISTINCT subq_39.third_hop_count) AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count',]
+ SELECT
+ subq_38.third_hop_count
+ FROM (
+ -- Constrain Output with WHERE
+ SELECT
+ subq_37.customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , subq_37.third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_36.customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , subq_36.third_hop_count
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_20.customer_third_hop_id AS customer_third_hop_id
+ , subq_35.account_id__customer_id__customer_third_hop_id AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id
+ , subq_35.account_id__customer_id__customer_third_hop_id__txn_count AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , subq_20.third_hop_count AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id']
+ SELECT
+ subq_19.customer_third_hop_id
+ , subq_19.third_hop_count
+ FROM (
+ -- Metric Time Dimension 'third_hop_ds'
+ SELECT
+ subq_18.third_hop_ds__day
+ , subq_18.third_hop_ds__week
+ , subq_18.third_hop_ds__month
+ , subq_18.third_hop_ds__quarter
+ , subq_18.third_hop_ds__year
+ , subq_18.third_hop_ds__extract_year
+ , subq_18.third_hop_ds__extract_quarter
+ , subq_18.third_hop_ds__extract_month
+ , subq_18.third_hop_ds__extract_day
+ , subq_18.third_hop_ds__extract_dow
+ , subq_18.third_hop_ds__extract_doy
+ , subq_18.customer_third_hop_id__third_hop_ds__day
+ , subq_18.customer_third_hop_id__third_hop_ds__week
+ , subq_18.customer_third_hop_id__third_hop_ds__month
+ , subq_18.customer_third_hop_id__third_hop_ds__quarter
+ , subq_18.customer_third_hop_id__third_hop_ds__year
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_year
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_quarter
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_month
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_day
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_dow
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_doy
+ , subq_18.third_hop_ds__day AS metric_time__day
+ , subq_18.third_hop_ds__week AS metric_time__week
+ , subq_18.third_hop_ds__month AS metric_time__month
+ , subq_18.third_hop_ds__quarter AS metric_time__quarter
+ , subq_18.third_hop_ds__year AS metric_time__year
+ , subq_18.third_hop_ds__extract_year AS metric_time__extract_year
+ , subq_18.third_hop_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_18.third_hop_ds__extract_month AS metric_time__extract_month
+ , subq_18.third_hop_ds__extract_day AS metric_time__extract_day
+ , subq_18.third_hop_ds__extract_dow AS metric_time__extract_dow
+ , subq_18.third_hop_ds__extract_doy AS metric_time__extract_doy
+ , subq_18.customer_third_hop_id
+ , subq_18.value
+ , subq_18.customer_third_hop_id__value
+ , subq_18.third_hop_count
+ FROM (
+ -- Read Elements From Semantic Model 'third_hop_table'
+ SELECT
+ third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ , third_hop_table_src_22000.value
+ , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, day) AS third_hop_ds__day
+ , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, isoweek) AS third_hop_ds__week
+ , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, month) AS third_hop_ds__month
+ , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, quarter) AS third_hop_ds__quarter
+ , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, year) AS third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_day
+ , IF(EXTRACT(dayofweek FROM third_hop_table_src_22000.third_hop_ds) = 1, 7, EXTRACT(dayofweek FROM third_hop_table_src_22000.third_hop_ds) - 1) AS third_hop_ds__extract_dow
+ , EXTRACT(dayofyear FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_doy
+ , third_hop_table_src_22000.value AS customer_third_hop_id__value
+ , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, day) AS customer_third_hop_id__third_hop_ds__day
+ , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, isoweek) AS customer_third_hop_id__third_hop_ds__week
+ , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, month) AS customer_third_hop_id__third_hop_ds__month
+ , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, quarter) AS customer_third_hop_id__third_hop_ds__quarter
+ , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, year) AS customer_third_hop_id__third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_day
+ , IF(EXTRACT(dayofweek FROM third_hop_table_src_22000.third_hop_ds) = 1, 7, EXTRACT(dayofweek FROM third_hop_table_src_22000.third_hop_ds) - 1) AS customer_third_hop_id__third_hop_ds__extract_dow
+ , EXTRACT(dayofyear FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_doy
+ , third_hop_table_src_22000.customer_third_hop_id
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ ) subq_18
+ ) subq_19
+ ) subq_20
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: ['account_id__customer_id__customer_third_hop_id', 'account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_34.account_id__customer_id__customer_third_hop_id
+ , subq_34.account_id__customer_id__customer_third_hop_id__txn_count
+ FROM (
+ -- Compute Metrics via Expressions
+ SELECT
+ subq_33.account_id__customer_id__customer_third_hop_id
+ , subq_33.txn_count AS account_id__customer_id__customer_third_hop_id__txn_count
+ FROM (
+ -- Aggregate Measures
+ SELECT
+ subq_32.account_id__customer_id__customer_third_hop_id
+ , SUM(subq_32.txn_count) AS txn_count
+ FROM (
+ -- Pass Only Elements: ['txn_count', 'account_id__customer_id__customer_third_hop_id']
+ SELECT
+ subq_31.account_id__customer_id__customer_third_hop_id
+ , subq_31.txn_count
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_23.ds_partitioned__day AS ds_partitioned__day
+ , subq_30.ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_23.account_id AS account_id
+ , subq_30.customer_id__customer_third_hop_id AS account_id__customer_id__customer_third_hop_id
+ , subq_23.txn_count AS txn_count
+ FROM (
+ -- Pass Only Elements: ['txn_count', 'ds_partitioned__day', 'account_id']
+ SELECT
+ subq_22.ds_partitioned__day
+ , subq_22.account_id
+ , subq_22.txn_count
+ FROM (
+ -- Metric Time Dimension 'ds'
+ SELECT
+ subq_21.ds_partitioned__day
+ , subq_21.ds_partitioned__week
+ , subq_21.ds_partitioned__month
+ , subq_21.ds_partitioned__quarter
+ , subq_21.ds_partitioned__year
+ , subq_21.ds_partitioned__extract_year
+ , subq_21.ds_partitioned__extract_quarter
+ , subq_21.ds_partitioned__extract_month
+ , subq_21.ds_partitioned__extract_day
+ , subq_21.ds_partitioned__extract_dow
+ , subq_21.ds_partitioned__extract_doy
+ , subq_21.ds__day
+ , subq_21.ds__week
+ , subq_21.ds__month
+ , subq_21.ds__quarter
+ , subq_21.ds__year
+ , subq_21.ds__extract_year
+ , subq_21.ds__extract_quarter
+ , subq_21.ds__extract_month
+ , subq_21.ds__extract_day
+ , subq_21.ds__extract_dow
+ , subq_21.ds__extract_doy
+ , subq_21.account_id__ds_partitioned__day
+ , subq_21.account_id__ds_partitioned__week
+ , subq_21.account_id__ds_partitioned__month
+ , subq_21.account_id__ds_partitioned__quarter
+ , subq_21.account_id__ds_partitioned__year
+ , subq_21.account_id__ds_partitioned__extract_year
+ , subq_21.account_id__ds_partitioned__extract_quarter
+ , subq_21.account_id__ds_partitioned__extract_month
+ , subq_21.account_id__ds_partitioned__extract_day
+ , subq_21.account_id__ds_partitioned__extract_dow
+ , subq_21.account_id__ds_partitioned__extract_doy
+ , subq_21.account_id__ds__day
+ , subq_21.account_id__ds__week
+ , subq_21.account_id__ds__month
+ , subq_21.account_id__ds__quarter
+ , subq_21.account_id__ds__year
+ , subq_21.account_id__ds__extract_year
+ , subq_21.account_id__ds__extract_quarter
+ , subq_21.account_id__ds__extract_month
+ , subq_21.account_id__ds__extract_day
+ , subq_21.account_id__ds__extract_dow
+ , subq_21.account_id__ds__extract_doy
+ , subq_21.ds__day AS metric_time__day
+ , subq_21.ds__week AS metric_time__week
+ , subq_21.ds__month AS metric_time__month
+ , subq_21.ds__quarter AS metric_time__quarter
+ , subq_21.ds__year AS metric_time__year
+ , subq_21.ds__extract_year AS metric_time__extract_year
+ , subq_21.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_21.ds__extract_month AS metric_time__extract_month
+ , subq_21.ds__extract_day AS metric_time__extract_day
+ , subq_21.ds__extract_dow AS metric_time__extract_dow
+ , subq_21.ds__extract_doy AS metric_time__extract_doy
+ , subq_21.account_id
+ , subq_21.account_month
+ , subq_21.account_id__account_month
+ , subq_21.txn_count
+ FROM (
+ -- Read Elements From Semantic Model 'account_month_txns'
+ SELECT
+ account_month_txns_src_22000.txn_count
+ , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, day) AS ds_partitioned__day
+ , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, isoweek) AS ds_partitioned__week
+ , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, month) AS ds_partitioned__month
+ , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, quarter) AS ds_partitioned__quarter
+ , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, year) AS ds_partitioned__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , IF(EXTRACT(dayofweek FROM account_month_txns_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM account_month_txns_src_22000.ds_partitioned) - 1) AS ds_partitioned__extract_dow
+ , EXTRACT(dayofyear FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC(account_month_txns_src_22000.ds, day) AS ds__day
+ , DATE_TRUNC(account_month_txns_src_22000.ds, isoweek) AS ds__week
+ , DATE_TRUNC(account_month_txns_src_22000.ds, month) AS ds__month
+ , DATE_TRUNC(account_month_txns_src_22000.ds, quarter) AS ds__quarter
+ , DATE_TRUNC(account_month_txns_src_22000.ds, year) AS ds__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds) AS ds__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS ds__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds) AS ds__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds) AS ds__extract_day
+ , IF(EXTRACT(dayofweek FROM account_month_txns_src_22000.ds) = 1, 7, EXTRACT(dayofweek FROM account_month_txns_src_22000.ds) - 1) AS ds__extract_dow
+ , EXTRACT(dayofyear FROM account_month_txns_src_22000.ds) AS ds__extract_doy
+ , account_month_txns_src_22000.account_month
+ , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, day) AS account_id__ds_partitioned__day
+ , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, isoweek) AS account_id__ds_partitioned__week
+ , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, month) AS account_id__ds_partitioned__month
+ , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, quarter) AS account_id__ds_partitioned__quarter
+ , DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, year) AS account_id__ds_partitioned__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
+ , IF(EXTRACT(dayofweek FROM account_month_txns_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM account_month_txns_src_22000.ds_partitioned) - 1) AS account_id__ds_partitioned__extract_dow
+ , EXTRACT(dayofyear FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
+ , DATE_TRUNC(account_month_txns_src_22000.ds, day) AS account_id__ds__day
+ , DATE_TRUNC(account_month_txns_src_22000.ds, isoweek) AS account_id__ds__week
+ , DATE_TRUNC(account_month_txns_src_22000.ds, month) AS account_id__ds__month
+ , DATE_TRUNC(account_month_txns_src_22000.ds, quarter) AS account_id__ds__quarter
+ , DATE_TRUNC(account_month_txns_src_22000.ds, year) AS account_id__ds__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM account_month_txns_src_22000.ds) = 1, 7, EXTRACT(dayofweek FROM account_month_txns_src_22000.ds) - 1) AS account_id__ds__extract_dow
+ , EXTRACT(dayofyear FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_doy
+ , account_month_txns_src_22000.account_month AS account_id__account_month
+ , account_month_txns_src_22000.account_id
+ FROM ***************************.account_month_txns account_month_txns_src_22000
+ ) subq_21
+ ) subq_22
+ ) subq_23
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: ['ds_partitioned__day', 'account_id', 'customer_id__customer_third_hop_id']
+ SELECT
+ subq_29.ds_partitioned__day
+ , subq_29.account_id
+ , subq_29.customer_id__customer_third_hop_id
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_25.ds_partitioned__day AS ds_partitioned__day
+ , subq_25.ds_partitioned__week AS ds_partitioned__week
+ , subq_25.ds_partitioned__month AS ds_partitioned__month
+ , subq_25.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_25.ds_partitioned__year AS ds_partitioned__year
+ , subq_25.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_25.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_25.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_25.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_25.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_25.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_25.account_id__ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_25.account_id__ds_partitioned__week AS account_id__ds_partitioned__week
+ , subq_25.account_id__ds_partitioned__month AS account_id__ds_partitioned__month
+ , subq_25.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter
+ , subq_25.account_id__ds_partitioned__year AS account_id__ds_partitioned__year
+ , subq_25.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year
+ , subq_25.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter
+ , subq_25.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month
+ , subq_25.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day
+ , subq_25.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow
+ , subq_25.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy
+ , subq_25.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day
+ , subq_25.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week
+ , subq_25.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month
+ , subq_25.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter
+ , subq_25.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year
+ , subq_25.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year
+ , subq_25.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter
+ , subq_25.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month
+ , subq_25.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day
+ , subq_25.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow
+ , subq_25.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy
+ , subq_25.metric_time__day AS metric_time__day
+ , subq_25.metric_time__week AS metric_time__week
+ , subq_25.metric_time__month AS metric_time__month
+ , subq_25.metric_time__quarter AS metric_time__quarter
+ , subq_25.metric_time__year AS metric_time__year
+ , subq_25.metric_time__extract_year AS metric_time__extract_year
+ , subq_25.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_25.metric_time__extract_month AS metric_time__extract_month
+ , subq_25.metric_time__extract_day AS metric_time__extract_day
+ , subq_25.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_25.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_28.acquired_ds__day AS customer_id__acquired_ds__day
+ , subq_28.acquired_ds__week AS customer_id__acquired_ds__week
+ , subq_28.acquired_ds__month AS customer_id__acquired_ds__month
+ , subq_28.acquired_ds__quarter AS customer_id__acquired_ds__quarter
+ , subq_28.acquired_ds__year AS customer_id__acquired_ds__year
+ , subq_28.acquired_ds__extract_year AS customer_id__acquired_ds__extract_year
+ , subq_28.acquired_ds__extract_quarter AS customer_id__acquired_ds__extract_quarter
+ , subq_28.acquired_ds__extract_month AS customer_id__acquired_ds__extract_month
+ , subq_28.acquired_ds__extract_day AS customer_id__acquired_ds__extract_day
+ , subq_28.acquired_ds__extract_dow AS customer_id__acquired_ds__extract_dow
+ , subq_28.acquired_ds__extract_doy AS customer_id__acquired_ds__extract_doy
+ , subq_28.customer_third_hop_id__acquired_ds__day AS customer_id__customer_third_hop_id__acquired_ds__day
+ , subq_28.customer_third_hop_id__acquired_ds__week AS customer_id__customer_third_hop_id__acquired_ds__week
+ , subq_28.customer_third_hop_id__acquired_ds__month AS customer_id__customer_third_hop_id__acquired_ds__month
+ , subq_28.customer_third_hop_id__acquired_ds__quarter AS customer_id__customer_third_hop_id__acquired_ds__quarter
+ , subq_28.customer_third_hop_id__acquired_ds__year AS customer_id__customer_third_hop_id__acquired_ds__year
+ , subq_28.customer_third_hop_id__acquired_ds__extract_year AS customer_id__customer_third_hop_id__acquired_ds__extract_year
+ , subq_28.customer_third_hop_id__acquired_ds__extract_quarter AS customer_id__customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_28.customer_third_hop_id__acquired_ds__extract_month AS customer_id__customer_third_hop_id__acquired_ds__extract_month
+ , subq_28.customer_third_hop_id__acquired_ds__extract_day AS customer_id__customer_third_hop_id__acquired_ds__extract_day
+ , subq_28.customer_third_hop_id__acquired_ds__extract_dow AS customer_id__customer_third_hop_id__acquired_ds__extract_dow
+ , subq_28.customer_third_hop_id__acquired_ds__extract_doy AS customer_id__customer_third_hop_id__acquired_ds__extract_doy
+ , subq_28.metric_time__day AS customer_id__metric_time__day
+ , subq_28.metric_time__week AS customer_id__metric_time__week
+ , subq_28.metric_time__month AS customer_id__metric_time__month
+ , subq_28.metric_time__quarter AS customer_id__metric_time__quarter
+ , subq_28.metric_time__year AS customer_id__metric_time__year
+ , subq_28.metric_time__extract_year AS customer_id__metric_time__extract_year
+ , subq_28.metric_time__extract_quarter AS customer_id__metric_time__extract_quarter
+ , subq_28.metric_time__extract_month AS customer_id__metric_time__extract_month
+ , subq_28.metric_time__extract_day AS customer_id__metric_time__extract_day
+ , subq_28.metric_time__extract_dow AS customer_id__metric_time__extract_dow
+ , subq_28.metric_time__extract_doy AS customer_id__metric_time__extract_doy
+ , subq_25.account_id AS account_id
+ , subq_25.customer_id AS customer_id
+ , subq_25.account_id__customer_id AS account_id__customer_id
+ , subq_25.bridge_account__account_id AS bridge_account__account_id
+ , subq_25.bridge_account__customer_id AS bridge_account__customer_id
+ , subq_28.customer_third_hop_id AS customer_id__customer_third_hop_id
+ , subq_28.customer_third_hop_id__customer_id AS customer_id__customer_third_hop_id__customer_id
+ , subq_25.extra_dim AS extra_dim
+ , subq_25.account_id__extra_dim AS account_id__extra_dim
+ , subq_25.bridge_account__extra_dim AS bridge_account__extra_dim
+ , subq_28.country AS customer_id__country
+ , subq_28.customer_third_hop_id__country AS customer_id__customer_third_hop_id__country
+ , subq_25.account_customer_combos AS account_customer_combos
+ FROM (
+ -- Metric Time Dimension 'ds_partitioned'
+ SELECT
+ subq_24.ds_partitioned__day
+ , subq_24.ds_partitioned__week
+ , subq_24.ds_partitioned__month
+ , subq_24.ds_partitioned__quarter
+ , subq_24.ds_partitioned__year
+ , subq_24.ds_partitioned__extract_year
+ , subq_24.ds_partitioned__extract_quarter
+ , subq_24.ds_partitioned__extract_month
+ , subq_24.ds_partitioned__extract_day
+ , subq_24.ds_partitioned__extract_dow
+ , subq_24.ds_partitioned__extract_doy
+ , subq_24.account_id__ds_partitioned__day
+ , subq_24.account_id__ds_partitioned__week
+ , subq_24.account_id__ds_partitioned__month
+ , subq_24.account_id__ds_partitioned__quarter
+ , subq_24.account_id__ds_partitioned__year
+ , subq_24.account_id__ds_partitioned__extract_year
+ , subq_24.account_id__ds_partitioned__extract_quarter
+ , subq_24.account_id__ds_partitioned__extract_month
+ , subq_24.account_id__ds_partitioned__extract_day
+ , subq_24.account_id__ds_partitioned__extract_dow
+ , subq_24.account_id__ds_partitioned__extract_doy
+ , subq_24.bridge_account__ds_partitioned__day
+ , subq_24.bridge_account__ds_partitioned__week
+ , subq_24.bridge_account__ds_partitioned__month
+ , subq_24.bridge_account__ds_partitioned__quarter
+ , subq_24.bridge_account__ds_partitioned__year
+ , subq_24.bridge_account__ds_partitioned__extract_year
+ , subq_24.bridge_account__ds_partitioned__extract_quarter
+ , subq_24.bridge_account__ds_partitioned__extract_month
+ , subq_24.bridge_account__ds_partitioned__extract_day
+ , subq_24.bridge_account__ds_partitioned__extract_dow
+ , subq_24.bridge_account__ds_partitioned__extract_doy
+ , subq_24.ds_partitioned__day AS metric_time__day
+ , subq_24.ds_partitioned__week AS metric_time__week
+ , subq_24.ds_partitioned__month AS metric_time__month
+ , subq_24.ds_partitioned__quarter AS metric_time__quarter
+ , subq_24.ds_partitioned__year AS metric_time__year
+ , subq_24.ds_partitioned__extract_year AS metric_time__extract_year
+ , subq_24.ds_partitioned__extract_quarter AS metric_time__extract_quarter
+ , subq_24.ds_partitioned__extract_month AS metric_time__extract_month
+ , subq_24.ds_partitioned__extract_day AS metric_time__extract_day
+ , subq_24.ds_partitioned__extract_dow AS metric_time__extract_dow
+ , subq_24.ds_partitioned__extract_doy AS metric_time__extract_doy
+ , subq_24.account_id
+ , subq_24.customer_id
+ , subq_24.account_id__customer_id
+ , subq_24.bridge_account__account_id
+ , subq_24.bridge_account__customer_id
+ , subq_24.extra_dim
+ , subq_24.account_id__extra_dim
+ , subq_24.bridge_account__extra_dim
+ , subq_24.account_customer_combos
+ FROM (
+ -- Read Elements From Semantic Model 'bridge_table'
+ SELECT
+ account_id || customer_id AS account_customer_combos
+ , bridge_table_src_22000.extra_dim
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS ds_partitioned__day
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, isoweek) AS ds_partitioned__week
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, month) AS ds_partitioned__month
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, quarter) AS ds_partitioned__quarter
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, year) AS ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , IF(EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) - 1) AS ds_partitioned__extract_dow
+ , EXTRACT(dayofyear FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS account_id__extra_dim
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS account_id__ds_partitioned__day
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, isoweek) AS account_id__ds_partitioned__week
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, month) AS account_id__ds_partitioned__month
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, quarter) AS account_id__ds_partitioned__quarter
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, year) AS account_id__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
+ , IF(EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) - 1) AS account_id__ds_partitioned__extract_dow
+ , EXTRACT(dayofyear FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS bridge_account__ds_partitioned__day
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, isoweek) AS bridge_account__ds_partitioned__week
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, month) AS bridge_account__ds_partitioned__month
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, quarter) AS bridge_account__ds_partitioned__quarter
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, year) AS bridge_account__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_day
+ , IF(EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) - 1) AS bridge_account__ds_partitioned__extract_dow
+ , EXTRACT(dayofyear FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy
+ , bridge_table_src_22000.account_id
+ , bridge_table_src_22000.customer_id
+ , bridge_table_src_22000.customer_id AS account_id__customer_id
+ , bridge_table_src_22000.account_id AS bridge_account__account_id
+ , bridge_table_src_22000.customer_id AS bridge_account__customer_id
+ FROM ***************************.bridge_table bridge_table_src_22000
+ ) subq_24
+ ) subq_25
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: [
+ -- 'country',
+ -- 'customer_id__country',
+ -- 'customer_third_hop_id__country',
+ -- 'acquired_ds__day',
+ -- 'acquired_ds__week',
+ -- 'acquired_ds__month',
+ -- 'acquired_ds__quarter',
+ -- 'acquired_ds__year',
+ -- 'acquired_ds__extract_year',
+ -- 'acquired_ds__extract_quarter',
+ -- 'acquired_ds__extract_month',
+ -- 'acquired_ds__extract_day',
+ -- 'acquired_ds__extract_dow',
+ -- 'acquired_ds__extract_doy',
+ -- 'customer_id__acquired_ds__day',
+ -- 'customer_id__acquired_ds__week',
+ -- 'customer_id__acquired_ds__month',
+ -- 'customer_id__acquired_ds__quarter',
+ -- 'customer_id__acquired_ds__year',
+ -- 'customer_id__acquired_ds__extract_year',
+ -- 'customer_id__acquired_ds__extract_quarter',
+ -- 'customer_id__acquired_ds__extract_month',
+ -- 'customer_id__acquired_ds__extract_day',
+ -- 'customer_id__acquired_ds__extract_dow',
+ -- 'customer_id__acquired_ds__extract_doy',
+ -- 'customer_third_hop_id__acquired_ds__day',
+ -- 'customer_third_hop_id__acquired_ds__week',
+ -- 'customer_third_hop_id__acquired_ds__month',
+ -- 'customer_third_hop_id__acquired_ds__quarter',
+ -- 'customer_third_hop_id__acquired_ds__year',
+ -- 'customer_third_hop_id__acquired_ds__extract_year',
+ -- 'customer_third_hop_id__acquired_ds__extract_quarter',
+ -- 'customer_third_hop_id__acquired_ds__extract_month',
+ -- 'customer_third_hop_id__acquired_ds__extract_day',
+ -- 'customer_third_hop_id__acquired_ds__extract_dow',
+ -- 'customer_third_hop_id__acquired_ds__extract_doy',
+ -- 'metric_time__day',
+ -- 'metric_time__week',
+ -- 'metric_time__month',
+ -- 'metric_time__quarter',
+ -- 'metric_time__year',
+ -- 'metric_time__extract_year',
+ -- 'metric_time__extract_quarter',
+ -- 'metric_time__extract_month',
+ -- 'metric_time__extract_day',
+ -- 'metric_time__extract_dow',
+ -- 'metric_time__extract_doy',
+ -- 'customer_id',
+ -- 'customer_third_hop_id',
+ -- 'customer_id__customer_third_hop_id',
+ -- 'customer_third_hop_id__customer_id',
+ -- ]
+ SELECT
+ subq_27.acquired_ds__day
+ , subq_27.acquired_ds__week
+ , subq_27.acquired_ds__month
+ , subq_27.acquired_ds__quarter
+ , subq_27.acquired_ds__year
+ , subq_27.acquired_ds__extract_year
+ , subq_27.acquired_ds__extract_quarter
+ , subq_27.acquired_ds__extract_month
+ , subq_27.acquired_ds__extract_day
+ , subq_27.acquired_ds__extract_dow
+ , subq_27.acquired_ds__extract_doy
+ , subq_27.customer_id__acquired_ds__day
+ , subq_27.customer_id__acquired_ds__week
+ , subq_27.customer_id__acquired_ds__month
+ , subq_27.customer_id__acquired_ds__quarter
+ , subq_27.customer_id__acquired_ds__year
+ , subq_27.customer_id__acquired_ds__extract_year
+ , subq_27.customer_id__acquired_ds__extract_quarter
+ , subq_27.customer_id__acquired_ds__extract_month
+ , subq_27.customer_id__acquired_ds__extract_day
+ , subq_27.customer_id__acquired_ds__extract_dow
+ , subq_27.customer_id__acquired_ds__extract_doy
+ , subq_27.customer_third_hop_id__acquired_ds__day
+ , subq_27.customer_third_hop_id__acquired_ds__week
+ , subq_27.customer_third_hop_id__acquired_ds__month
+ , subq_27.customer_third_hop_id__acquired_ds__quarter
+ , subq_27.customer_third_hop_id__acquired_ds__year
+ , subq_27.customer_third_hop_id__acquired_ds__extract_year
+ , subq_27.customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_27.customer_third_hop_id__acquired_ds__extract_month
+ , subq_27.customer_third_hop_id__acquired_ds__extract_day
+ , subq_27.customer_third_hop_id__acquired_ds__extract_dow
+ , subq_27.customer_third_hop_id__acquired_ds__extract_doy
+ , subq_27.metric_time__day
+ , subq_27.metric_time__week
+ , subq_27.metric_time__month
+ , subq_27.metric_time__quarter
+ , subq_27.metric_time__year
+ , subq_27.metric_time__extract_year
+ , subq_27.metric_time__extract_quarter
+ , subq_27.metric_time__extract_month
+ , subq_27.metric_time__extract_day
+ , subq_27.metric_time__extract_dow
+ , subq_27.metric_time__extract_doy
+ , subq_27.customer_id
+ , subq_27.customer_third_hop_id
+ , subq_27.customer_id__customer_third_hop_id
+ , subq_27.customer_third_hop_id__customer_id
+ , subq_27.country
+ , subq_27.customer_id__country
+ , subq_27.customer_third_hop_id__country
+ FROM (
+ -- Metric Time Dimension 'acquired_ds'
+ SELECT
+ subq_26.acquired_ds__day
+ , subq_26.acquired_ds__week
+ , subq_26.acquired_ds__month
+ , subq_26.acquired_ds__quarter
+ , subq_26.acquired_ds__year
+ , subq_26.acquired_ds__extract_year
+ , subq_26.acquired_ds__extract_quarter
+ , subq_26.acquired_ds__extract_month
+ , subq_26.acquired_ds__extract_day
+ , subq_26.acquired_ds__extract_dow
+ , subq_26.acquired_ds__extract_doy
+ , subq_26.customer_id__acquired_ds__day
+ , subq_26.customer_id__acquired_ds__week
+ , subq_26.customer_id__acquired_ds__month
+ , subq_26.customer_id__acquired_ds__quarter
+ , subq_26.customer_id__acquired_ds__year
+ , subq_26.customer_id__acquired_ds__extract_year
+ , subq_26.customer_id__acquired_ds__extract_quarter
+ , subq_26.customer_id__acquired_ds__extract_month
+ , subq_26.customer_id__acquired_ds__extract_day
+ , subq_26.customer_id__acquired_ds__extract_dow
+ , subq_26.customer_id__acquired_ds__extract_doy
+ , subq_26.customer_third_hop_id__acquired_ds__day
+ , subq_26.customer_third_hop_id__acquired_ds__week
+ , subq_26.customer_third_hop_id__acquired_ds__month
+ , subq_26.customer_third_hop_id__acquired_ds__quarter
+ , subq_26.customer_third_hop_id__acquired_ds__year
+ , subq_26.customer_third_hop_id__acquired_ds__extract_year
+ , subq_26.customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_26.customer_third_hop_id__acquired_ds__extract_month
+ , subq_26.customer_third_hop_id__acquired_ds__extract_day
+ , subq_26.customer_third_hop_id__acquired_ds__extract_dow
+ , subq_26.customer_third_hop_id__acquired_ds__extract_doy
+ , subq_26.acquired_ds__day AS metric_time__day
+ , subq_26.acquired_ds__week AS metric_time__week
+ , subq_26.acquired_ds__month AS metric_time__month
+ , subq_26.acquired_ds__quarter AS metric_time__quarter
+ , subq_26.acquired_ds__year AS metric_time__year
+ , subq_26.acquired_ds__extract_year AS metric_time__extract_year
+ , subq_26.acquired_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_26.acquired_ds__extract_month AS metric_time__extract_month
+ , subq_26.acquired_ds__extract_day AS metric_time__extract_day
+ , subq_26.acquired_ds__extract_dow AS metric_time__extract_dow
+ , subq_26.acquired_ds__extract_doy AS metric_time__extract_doy
+ , subq_26.customer_id
+ , subq_26.customer_third_hop_id
+ , subq_26.customer_id__customer_third_hop_id
+ , subq_26.customer_third_hop_id__customer_id
+ , subq_26.country
+ , subq_26.customer_id__country
+ , subq_26.customer_third_hop_id__country
+ , subq_26.customers_with_other_data
+ FROM (
+ -- Read Elements From Semantic Model 'customer_other_data'
+ SELECT
+ 1 AS customers_with_other_data
+ , customer_other_data_src_22000.country
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, day) AS acquired_ds__day
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, isoweek) AS acquired_ds__week
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, month) AS acquired_ds__month
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, quarter) AS acquired_ds__quarter
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, year) AS acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_day
+ , IF(EXTRACT(dayofweek FROM customer_other_data_src_22000.acquired_ds) = 1, 7, EXTRACT(dayofweek FROM customer_other_data_src_22000.acquired_ds) - 1) AS acquired_ds__extract_dow
+ , EXTRACT(dayofyear FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_id__country
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, day) AS customer_id__acquired_ds__day
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, isoweek) AS customer_id__acquired_ds__week
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, month) AS customer_id__acquired_ds__month
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, quarter) AS customer_id__acquired_ds__quarter
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, year) AS customer_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_day
+ , IF(EXTRACT(dayofweek FROM customer_other_data_src_22000.acquired_ds) = 1, 7, EXTRACT(dayofweek FROM customer_other_data_src_22000.acquired_ds) - 1) AS customer_id__acquired_ds__extract_dow
+ , EXTRACT(dayofyear FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_third_hop_id__country
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, day) AS customer_third_hop_id__acquired_ds__day
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, isoweek) AS customer_third_hop_id__acquired_ds__week
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, month) AS customer_third_hop_id__acquired_ds__month
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, quarter) AS customer_third_hop_id__acquired_ds__quarter
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, year) AS customer_third_hop_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_day
+ , IF(EXTRACT(dayofweek FROM customer_other_data_src_22000.acquired_ds) = 1, 7, EXTRACT(dayofweek FROM customer_other_data_src_22000.acquired_ds) - 1) AS customer_third_hop_id__acquired_ds__extract_dow
+ , EXTRACT(dayofyear FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.customer_id
+ , customer_other_data_src_22000.customer_third_hop_id
+ , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id
+ , customer_other_data_src_22000.customer_id AS customer_third_hop_id__customer_id
+ FROM ***************************.customer_other_data customer_other_data_src_22000
+ ) subq_26
+ ) subq_27
+ ) subq_28
+ ON
+ subq_25.customer_id = subq_28.customer_id
+ ) subq_29
+ ) subq_30
+ ON
+ (
+ subq_23.account_id = subq_30.account_id
+ ) AND (
+ subq_23.ds_partitioned__day = subq_30.ds_partitioned__day
+ )
+ ) subq_31
+ ) subq_32
+ GROUP BY
+ account_id__customer_id__customer_third_hop_id
+ ) subq_33
+ ) subq_34
+ ) subq_35
+ ON
+ subq_20.customer_third_hop_id = subq_35.account_id__customer_id__customer_third_hop_id
+ ) subq_36
+ ) subq_37
+ WHERE customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count > 2
+ ) subq_38
+ ) subq_39
+) subq_40
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_multi_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_multi_hop__plan0_optimized.sql
new file mode 100644
index 0000000000..256af26325
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_multi_hop__plan0_optimized.sql
@@ -0,0 +1,49 @@
+-- Constrain Output with WHERE
+-- Pass Only Elements: ['third_hop_count',]
+-- Aggregate Measures
+-- Compute Metrics via Expressions
+SELECT
+ COUNT(DISTINCT third_hop_count) AS third_hop_count
+FROM (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_58.account_id__customer_id__customer_third_hop_id__txn_count AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ LEFT OUTER JOIN (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['txn_count', 'account_id__customer_id__customer_third_hop_id']
+ -- Aggregate Measures
+ -- Compute Metrics via Expressions
+ -- Pass Only Elements: ['account_id__customer_id__customer_third_hop_id', 'account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_53.customer_id__customer_third_hop_id AS account_id__customer_id__customer_third_hop_id
+ , SUM(account_month_txns_src_22000.txn_count) AS account_id__customer_id__customer_third_hop_id__txn_count
+ FROM ***************************.account_month_txns account_month_txns_src_22000
+ LEFT OUTER JOIN (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['ds_partitioned__day', 'account_id', 'customer_id__customer_third_hop_id']
+ SELECT
+ DATE_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS ds_partitioned__day
+ , bridge_table_src_22000.account_id AS account_id
+ , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id
+ FROM ***************************.bridge_table bridge_table_src_22000
+ LEFT OUTER JOIN
+ ***************************.customer_other_data customer_other_data_src_22000
+ ON
+ bridge_table_src_22000.customer_id = customer_other_data_src_22000.customer_id
+ ) subq_53
+ ON
+ (
+ account_month_txns_src_22000.account_id = subq_53.account_id
+ ) AND (
+ DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, day) = subq_53.ds_partitioned__day
+ )
+ GROUP BY
+ account_id__customer_id__customer_third_hop_id
+ ) subq_58
+ ON
+ third_hop_table_src_22000.customer_third_hop_id = subq_58.account_id__customer_id__customer_third_hop_id
+) subq_60
+WHERE customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count > 2
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_single_hop__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_single_hop__plan0.sql
new file mode 100644
index 0000000000..153ad50485
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_single_hop__plan0.sql
@@ -0,0 +1,257 @@
+-- Compute Metrics via Expressions
+SELECT
+ subq_21.third_hop_count
+FROM (
+ -- Aggregate Measures
+ SELECT
+ COUNT(DISTINCT subq_20.third_hop_count) AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count',]
+ SELECT
+ subq_19.third_hop_count
+ FROM (
+ -- Constrain Output with WHERE
+ SELECT
+ subq_18.customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , subq_18.third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ subq_17.customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , subq_17.third_hop_count
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_8.customer_third_hop_id AS customer_third_hop_id
+ , subq_16.customer_id__customer_third_hop_id AS customer_third_hop_id__customer_id__customer_third_hop_id
+ , subq_16.customer_id__customer_third_hop_id__paraguayan_customers AS customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , subq_8.third_hop_count AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id']
+ SELECT
+ subq_7.customer_third_hop_id
+ , subq_7.third_hop_count
+ FROM (
+ -- Metric Time Dimension 'third_hop_ds'
+ SELECT
+ subq_6.third_hop_ds__day
+ , subq_6.third_hop_ds__week
+ , subq_6.third_hop_ds__month
+ , subq_6.third_hop_ds__quarter
+ , subq_6.third_hop_ds__year
+ , subq_6.third_hop_ds__extract_year
+ , subq_6.third_hop_ds__extract_quarter
+ , subq_6.third_hop_ds__extract_month
+ , subq_6.third_hop_ds__extract_day
+ , subq_6.third_hop_ds__extract_dow
+ , subq_6.third_hop_ds__extract_doy
+ , subq_6.customer_third_hop_id__third_hop_ds__day
+ , subq_6.customer_third_hop_id__third_hop_ds__week
+ , subq_6.customer_third_hop_id__third_hop_ds__month
+ , subq_6.customer_third_hop_id__third_hop_ds__quarter
+ , subq_6.customer_third_hop_id__third_hop_ds__year
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_year
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_quarter
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_month
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_day
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_dow
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_doy
+ , subq_6.third_hop_ds__day AS metric_time__day
+ , subq_6.third_hop_ds__week AS metric_time__week
+ , subq_6.third_hop_ds__month AS metric_time__month
+ , subq_6.third_hop_ds__quarter AS metric_time__quarter
+ , subq_6.third_hop_ds__year AS metric_time__year
+ , subq_6.third_hop_ds__extract_year AS metric_time__extract_year
+ , subq_6.third_hop_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_6.third_hop_ds__extract_month AS metric_time__extract_month
+ , subq_6.third_hop_ds__extract_day AS metric_time__extract_day
+ , subq_6.third_hop_ds__extract_dow AS metric_time__extract_dow
+ , subq_6.third_hop_ds__extract_doy AS metric_time__extract_doy
+ , subq_6.customer_third_hop_id
+ , subq_6.value
+ , subq_6.customer_third_hop_id__value
+ , subq_6.third_hop_count
+ FROM (
+ -- Read Elements From Semantic Model 'third_hop_table'
+ SELECT
+ third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ , third_hop_table_src_22000.value
+ , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, day) AS third_hop_ds__day
+ , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, isoweek) AS third_hop_ds__week
+ , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, month) AS third_hop_ds__month
+ , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, quarter) AS third_hop_ds__quarter
+ , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, year) AS third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_day
+ , IF(EXTRACT(dayofweek FROM third_hop_table_src_22000.third_hop_ds) = 1, 7, EXTRACT(dayofweek FROM third_hop_table_src_22000.third_hop_ds) - 1) AS third_hop_ds__extract_dow
+ , EXTRACT(dayofyear FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_doy
+ , third_hop_table_src_22000.value AS customer_third_hop_id__value
+ , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, day) AS customer_third_hop_id__third_hop_ds__day
+ , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, isoweek) AS customer_third_hop_id__third_hop_ds__week
+ , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, month) AS customer_third_hop_id__third_hop_ds__month
+ , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, quarter) AS customer_third_hop_id__third_hop_ds__quarter
+ , DATE_TRUNC(third_hop_table_src_22000.third_hop_ds, year) AS customer_third_hop_id__third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_day
+ , IF(EXTRACT(dayofweek FROM third_hop_table_src_22000.third_hop_ds) = 1, 7, EXTRACT(dayofweek FROM third_hop_table_src_22000.third_hop_ds) - 1) AS customer_third_hop_id__third_hop_ds__extract_dow
+ , EXTRACT(dayofyear FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_doy
+ , third_hop_table_src_22000.customer_third_hop_id
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ ) subq_6
+ ) subq_7
+ ) subq_8
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: ['customer_id__customer_third_hop_id', 'customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ subq_15.customer_id__customer_third_hop_id
+ , subq_15.customer_id__customer_third_hop_id__paraguayan_customers
+ FROM (
+ -- Compute Metrics via Expressions
+ SELECT
+ subq_14.customer_id__customer_third_hop_id
+ , subq_14.customers_with_other_data AS customer_id__customer_third_hop_id__paraguayan_customers
+ FROM (
+ -- Aggregate Measures
+ SELECT
+ subq_13.customer_id__customer_third_hop_id
+ , SUM(subq_13.customers_with_other_data) AS customers_with_other_data
+ FROM (
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__customer_third_hop_id']
+ SELECT
+ subq_12.customer_id__customer_third_hop_id
+ , subq_12.customers_with_other_data
+ FROM (
+ -- Constrain Output with WHERE
+ SELECT
+ subq_11.customer_id__customer_third_hop_id
+ , subq_11.customer_id__country
+ , subq_11.customers_with_other_data
+ FROM (
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id']
+ SELECT
+ subq_10.customer_id__customer_third_hop_id
+ , subq_10.customer_id__country
+ , subq_10.customers_with_other_data
+ FROM (
+ -- Metric Time Dimension 'acquired_ds'
+ SELECT
+ subq_9.acquired_ds__day
+ , subq_9.acquired_ds__week
+ , subq_9.acquired_ds__month
+ , subq_9.acquired_ds__quarter
+ , subq_9.acquired_ds__year
+ , subq_9.acquired_ds__extract_year
+ , subq_9.acquired_ds__extract_quarter
+ , subq_9.acquired_ds__extract_month
+ , subq_9.acquired_ds__extract_day
+ , subq_9.acquired_ds__extract_dow
+ , subq_9.acquired_ds__extract_doy
+ , subq_9.customer_id__acquired_ds__day
+ , subq_9.customer_id__acquired_ds__week
+ , subq_9.customer_id__acquired_ds__month
+ , subq_9.customer_id__acquired_ds__quarter
+ , subq_9.customer_id__acquired_ds__year
+ , subq_9.customer_id__acquired_ds__extract_year
+ , subq_9.customer_id__acquired_ds__extract_quarter
+ , subq_9.customer_id__acquired_ds__extract_month
+ , subq_9.customer_id__acquired_ds__extract_day
+ , subq_9.customer_id__acquired_ds__extract_dow
+ , subq_9.customer_id__acquired_ds__extract_doy
+ , subq_9.customer_third_hop_id__acquired_ds__day
+ , subq_9.customer_third_hop_id__acquired_ds__week
+ , subq_9.customer_third_hop_id__acquired_ds__month
+ , subq_9.customer_third_hop_id__acquired_ds__quarter
+ , subq_9.customer_third_hop_id__acquired_ds__year
+ , subq_9.customer_third_hop_id__acquired_ds__extract_year
+ , subq_9.customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_9.customer_third_hop_id__acquired_ds__extract_month
+ , subq_9.customer_third_hop_id__acquired_ds__extract_day
+ , subq_9.customer_third_hop_id__acquired_ds__extract_dow
+ , subq_9.customer_third_hop_id__acquired_ds__extract_doy
+ , subq_9.acquired_ds__day AS metric_time__day
+ , subq_9.acquired_ds__week AS metric_time__week
+ , subq_9.acquired_ds__month AS metric_time__month
+ , subq_9.acquired_ds__quarter AS metric_time__quarter
+ , subq_9.acquired_ds__year AS metric_time__year
+ , subq_9.acquired_ds__extract_year AS metric_time__extract_year
+ , subq_9.acquired_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.acquired_ds__extract_month AS metric_time__extract_month
+ , subq_9.acquired_ds__extract_day AS metric_time__extract_day
+ , subq_9.acquired_ds__extract_dow AS metric_time__extract_dow
+ , subq_9.acquired_ds__extract_doy AS metric_time__extract_doy
+ , subq_9.customer_id
+ , subq_9.customer_third_hop_id
+ , subq_9.customer_id__customer_third_hop_id
+ , subq_9.customer_third_hop_id__customer_id
+ , subq_9.country
+ , subq_9.customer_id__country
+ , subq_9.customer_third_hop_id__country
+ , subq_9.customers_with_other_data
+ FROM (
+ -- Read Elements From Semantic Model 'customer_other_data'
+ SELECT
+ 1 AS customers_with_other_data
+ , customer_other_data_src_22000.country
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, day) AS acquired_ds__day
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, isoweek) AS acquired_ds__week
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, month) AS acquired_ds__month
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, quarter) AS acquired_ds__quarter
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, year) AS acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_day
+ , IF(EXTRACT(dayofweek FROM customer_other_data_src_22000.acquired_ds) = 1, 7, EXTRACT(dayofweek FROM customer_other_data_src_22000.acquired_ds) - 1) AS acquired_ds__extract_dow
+ , EXTRACT(dayofyear FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_id__country
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, day) AS customer_id__acquired_ds__day
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, isoweek) AS customer_id__acquired_ds__week
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, month) AS customer_id__acquired_ds__month
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, quarter) AS customer_id__acquired_ds__quarter
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, year) AS customer_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_day
+ , IF(EXTRACT(dayofweek FROM customer_other_data_src_22000.acquired_ds) = 1, 7, EXTRACT(dayofweek FROM customer_other_data_src_22000.acquired_ds) - 1) AS customer_id__acquired_ds__extract_dow
+ , EXTRACT(dayofyear FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_third_hop_id__country
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, day) AS customer_third_hop_id__acquired_ds__day
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, isoweek) AS customer_third_hop_id__acquired_ds__week
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, month) AS customer_third_hop_id__acquired_ds__month
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, quarter) AS customer_third_hop_id__acquired_ds__quarter
+ , DATE_TRUNC(customer_other_data_src_22000.acquired_ds, year) AS customer_third_hop_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_day
+ , IF(EXTRACT(dayofweek FROM customer_other_data_src_22000.acquired_ds) = 1, 7, EXTRACT(dayofweek FROM customer_other_data_src_22000.acquired_ds) - 1) AS customer_third_hop_id__acquired_ds__extract_dow
+ , EXTRACT(dayofyear FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.customer_id
+ , customer_other_data_src_22000.customer_third_hop_id
+ , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id
+ , customer_other_data_src_22000.customer_id AS customer_third_hop_id__customer_id
+ FROM ***************************.customer_other_data customer_other_data_src_22000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+ WHERE customer_id__country = 'paraguay'
+ ) subq_12
+ ) subq_13
+ GROUP BY
+ customer_id__customer_third_hop_id
+ ) subq_14
+ ) subq_15
+ ) subq_16
+ ON
+ subq_8.customer_third_hop_id = subq_16.customer_id__customer_third_hop_id
+ ) subq_17
+ ) subq_18
+ WHERE customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers > 0
+ ) subq_19
+ ) subq_20
+) subq_21
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_single_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_single_hop__plan0_optimized.sql
new file mode 100644
index 0000000000..2ad52ec04c
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/BigQuery/test_inner_query_single_hop__plan0_optimized.sql
@@ -0,0 +1,40 @@
+-- Constrain Output with WHERE
+-- Pass Only Elements: ['third_hop_count',]
+-- Aggregate Measures
+-- Compute Metrics via Expressions
+SELECT
+ COUNT(DISTINCT third_hop_count) AS third_hop_count
+FROM (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ subq_32.customer_id__customer_third_hop_id__paraguayan_customers AS customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ LEFT OUTER JOIN (
+ -- Constrain Output with WHERE
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__customer_third_hop_id']
+ -- Aggregate Measures
+ -- Compute Metrics via Expressions
+ -- Pass Only Elements: ['customer_id__customer_third_hop_id', 'customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ customer_id__customer_third_hop_id
+ , SUM(customers_with_other_data) AS customer_id__customer_third_hop_id__paraguayan_customers
+ FROM (
+ -- Read Elements From Semantic Model 'customer_other_data'
+ -- Metric Time Dimension 'acquired_ds'
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id']
+ SELECT
+ customer_third_hop_id AS customer_id__customer_third_hop_id
+ , country AS customer_id__country
+ , 1 AS customers_with_other_data
+ FROM ***************************.customer_other_data customer_other_data_src_22000
+ ) subq_27
+ WHERE customer_id__country = 'paraguay'
+ GROUP BY
+ customer_id__customer_third_hop_id
+ ) subq_32
+ ON
+ third_hop_table_src_22000.customer_third_hop_id = subq_32.customer_id__customer_third_hop_id
+) subq_34
+WHERE customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers > 0
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Databricks/test_inner_query_multi_hop__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Databricks/test_inner_query_multi_hop__plan0.sql
new file mode 100644
index 0000000000..6dc41eb37f
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Databricks/test_inner_query_multi_hop__plan0.sql
@@ -0,0 +1,694 @@
+-- Compute Metrics via Expressions
+SELECT
+ subq_40.third_hop_count
+FROM (
+ -- Aggregate Measures
+ SELECT
+ COUNT(DISTINCT subq_39.third_hop_count) AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count',]
+ SELECT
+ subq_38.third_hop_count
+ FROM (
+ -- Constrain Output with WHERE
+ SELECT
+ subq_37.customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , subq_37.third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_36.customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , subq_36.third_hop_count
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_20.customer_third_hop_id AS customer_third_hop_id
+ , subq_35.account_id__customer_id__customer_third_hop_id AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id
+ , subq_35.account_id__customer_id__customer_third_hop_id__txn_count AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , subq_20.third_hop_count AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id']
+ SELECT
+ subq_19.customer_third_hop_id
+ , subq_19.third_hop_count
+ FROM (
+ -- Metric Time Dimension 'third_hop_ds'
+ SELECT
+ subq_18.third_hop_ds__day
+ , subq_18.third_hop_ds__week
+ , subq_18.third_hop_ds__month
+ , subq_18.third_hop_ds__quarter
+ , subq_18.third_hop_ds__year
+ , subq_18.third_hop_ds__extract_year
+ , subq_18.third_hop_ds__extract_quarter
+ , subq_18.third_hop_ds__extract_month
+ , subq_18.third_hop_ds__extract_day
+ , subq_18.third_hop_ds__extract_dow
+ , subq_18.third_hop_ds__extract_doy
+ , subq_18.customer_third_hop_id__third_hop_ds__day
+ , subq_18.customer_third_hop_id__third_hop_ds__week
+ , subq_18.customer_third_hop_id__third_hop_ds__month
+ , subq_18.customer_third_hop_id__third_hop_ds__quarter
+ , subq_18.customer_third_hop_id__third_hop_ds__year
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_year
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_quarter
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_month
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_day
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_dow
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_doy
+ , subq_18.third_hop_ds__day AS metric_time__day
+ , subq_18.third_hop_ds__week AS metric_time__week
+ , subq_18.third_hop_ds__month AS metric_time__month
+ , subq_18.third_hop_ds__quarter AS metric_time__quarter
+ , subq_18.third_hop_ds__year AS metric_time__year
+ , subq_18.third_hop_ds__extract_year AS metric_time__extract_year
+ , subq_18.third_hop_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_18.third_hop_ds__extract_month AS metric_time__extract_month
+ , subq_18.third_hop_ds__extract_day AS metric_time__extract_day
+ , subq_18.third_hop_ds__extract_dow AS metric_time__extract_dow
+ , subq_18.third_hop_ds__extract_doy AS metric_time__extract_doy
+ , subq_18.customer_third_hop_id
+ , subq_18.value
+ , subq_18.customer_third_hop_id__value
+ , subq_18.third_hop_count
+ FROM (
+ -- Read Elements From Semantic Model 'third_hop_table'
+ SELECT
+ third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ , third_hop_table_src_22000.value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_doy
+ , third_hop_table_src_22000.value AS customer_third_hop_id__value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_doy
+ , third_hop_table_src_22000.customer_third_hop_id
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ ) subq_18
+ ) subq_19
+ ) subq_20
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: ['account_id__customer_id__customer_third_hop_id', 'account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_34.account_id__customer_id__customer_third_hop_id
+ , subq_34.account_id__customer_id__customer_third_hop_id__txn_count
+ FROM (
+ -- Compute Metrics via Expressions
+ SELECT
+ subq_33.account_id__customer_id__customer_third_hop_id
+ , subq_33.txn_count AS account_id__customer_id__customer_third_hop_id__txn_count
+ FROM (
+ -- Aggregate Measures
+ SELECT
+ subq_32.account_id__customer_id__customer_third_hop_id
+ , SUM(subq_32.txn_count) AS txn_count
+ FROM (
+ -- Pass Only Elements: ['txn_count', 'account_id__customer_id__customer_third_hop_id']
+ SELECT
+ subq_31.account_id__customer_id__customer_third_hop_id
+ , subq_31.txn_count
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_23.ds_partitioned__day AS ds_partitioned__day
+ , subq_30.ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_23.account_id AS account_id
+ , subq_30.customer_id__customer_third_hop_id AS account_id__customer_id__customer_third_hop_id
+ , subq_23.txn_count AS txn_count
+ FROM (
+ -- Pass Only Elements: ['txn_count', 'ds_partitioned__day', 'account_id']
+ SELECT
+ subq_22.ds_partitioned__day
+ , subq_22.account_id
+ , subq_22.txn_count
+ FROM (
+ -- Metric Time Dimension 'ds'
+ SELECT
+ subq_21.ds_partitioned__day
+ , subq_21.ds_partitioned__week
+ , subq_21.ds_partitioned__month
+ , subq_21.ds_partitioned__quarter
+ , subq_21.ds_partitioned__year
+ , subq_21.ds_partitioned__extract_year
+ , subq_21.ds_partitioned__extract_quarter
+ , subq_21.ds_partitioned__extract_month
+ , subq_21.ds_partitioned__extract_day
+ , subq_21.ds_partitioned__extract_dow
+ , subq_21.ds_partitioned__extract_doy
+ , subq_21.ds__day
+ , subq_21.ds__week
+ , subq_21.ds__month
+ , subq_21.ds__quarter
+ , subq_21.ds__year
+ , subq_21.ds__extract_year
+ , subq_21.ds__extract_quarter
+ , subq_21.ds__extract_month
+ , subq_21.ds__extract_day
+ , subq_21.ds__extract_dow
+ , subq_21.ds__extract_doy
+ , subq_21.account_id__ds_partitioned__day
+ , subq_21.account_id__ds_partitioned__week
+ , subq_21.account_id__ds_partitioned__month
+ , subq_21.account_id__ds_partitioned__quarter
+ , subq_21.account_id__ds_partitioned__year
+ , subq_21.account_id__ds_partitioned__extract_year
+ , subq_21.account_id__ds_partitioned__extract_quarter
+ , subq_21.account_id__ds_partitioned__extract_month
+ , subq_21.account_id__ds_partitioned__extract_day
+ , subq_21.account_id__ds_partitioned__extract_dow
+ , subq_21.account_id__ds_partitioned__extract_doy
+ , subq_21.account_id__ds__day
+ , subq_21.account_id__ds__week
+ , subq_21.account_id__ds__month
+ , subq_21.account_id__ds__quarter
+ , subq_21.account_id__ds__year
+ , subq_21.account_id__ds__extract_year
+ , subq_21.account_id__ds__extract_quarter
+ , subq_21.account_id__ds__extract_month
+ , subq_21.account_id__ds__extract_day
+ , subq_21.account_id__ds__extract_dow
+ , subq_21.account_id__ds__extract_doy
+ , subq_21.ds__day AS metric_time__day
+ , subq_21.ds__week AS metric_time__week
+ , subq_21.ds__month AS metric_time__month
+ , subq_21.ds__quarter AS metric_time__quarter
+ , subq_21.ds__year AS metric_time__year
+ , subq_21.ds__extract_year AS metric_time__extract_year
+ , subq_21.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_21.ds__extract_month AS metric_time__extract_month
+ , subq_21.ds__extract_day AS metric_time__extract_day
+ , subq_21.ds__extract_dow AS metric_time__extract_dow
+ , subq_21.ds__extract_doy AS metric_time__extract_doy
+ , subq_21.account_id
+ , subq_21.account_month
+ , subq_21.account_id__account_month
+ , subq_21.txn_count
+ FROM (
+ -- Read Elements From Semantic Model 'account_month_txns'
+ SELECT
+ account_month_txns_src_22000.txn_count
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS ds__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS ds__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS ds__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS ds__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS ds__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds) AS ds__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS ds__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds) AS ds__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds) AS ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM account_month_txns_src_22000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS ds__extract_doy
+ , account_month_txns_src_22000.account_month
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS account_id__ds__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS account_id__ds__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS account_id__ds__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS account_id__ds__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS account_id__ds__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_doy
+ , account_month_txns_src_22000.account_month AS account_id__account_month
+ , account_month_txns_src_22000.account_id
+ FROM ***************************.account_month_txns account_month_txns_src_22000
+ ) subq_21
+ ) subq_22
+ ) subq_23
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: ['ds_partitioned__day', 'account_id', 'customer_id__customer_third_hop_id']
+ SELECT
+ subq_29.ds_partitioned__day
+ , subq_29.account_id
+ , subq_29.customer_id__customer_third_hop_id
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_25.ds_partitioned__day AS ds_partitioned__day
+ , subq_25.ds_partitioned__week AS ds_partitioned__week
+ , subq_25.ds_partitioned__month AS ds_partitioned__month
+ , subq_25.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_25.ds_partitioned__year AS ds_partitioned__year
+ , subq_25.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_25.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_25.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_25.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_25.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_25.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_25.account_id__ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_25.account_id__ds_partitioned__week AS account_id__ds_partitioned__week
+ , subq_25.account_id__ds_partitioned__month AS account_id__ds_partitioned__month
+ , subq_25.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter
+ , subq_25.account_id__ds_partitioned__year AS account_id__ds_partitioned__year
+ , subq_25.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year
+ , subq_25.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter
+ , subq_25.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month
+ , subq_25.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day
+ , subq_25.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow
+ , subq_25.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy
+ , subq_25.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day
+ , subq_25.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week
+ , subq_25.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month
+ , subq_25.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter
+ , subq_25.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year
+ , subq_25.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year
+ , subq_25.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter
+ , subq_25.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month
+ , subq_25.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day
+ , subq_25.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow
+ , subq_25.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy
+ , subq_25.metric_time__day AS metric_time__day
+ , subq_25.metric_time__week AS metric_time__week
+ , subq_25.metric_time__month AS metric_time__month
+ , subq_25.metric_time__quarter AS metric_time__quarter
+ , subq_25.metric_time__year AS metric_time__year
+ , subq_25.metric_time__extract_year AS metric_time__extract_year
+ , subq_25.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_25.metric_time__extract_month AS metric_time__extract_month
+ , subq_25.metric_time__extract_day AS metric_time__extract_day
+ , subq_25.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_25.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_28.acquired_ds__day AS customer_id__acquired_ds__day
+ , subq_28.acquired_ds__week AS customer_id__acquired_ds__week
+ , subq_28.acquired_ds__month AS customer_id__acquired_ds__month
+ , subq_28.acquired_ds__quarter AS customer_id__acquired_ds__quarter
+ , subq_28.acquired_ds__year AS customer_id__acquired_ds__year
+ , subq_28.acquired_ds__extract_year AS customer_id__acquired_ds__extract_year
+ , subq_28.acquired_ds__extract_quarter AS customer_id__acquired_ds__extract_quarter
+ , subq_28.acquired_ds__extract_month AS customer_id__acquired_ds__extract_month
+ , subq_28.acquired_ds__extract_day AS customer_id__acquired_ds__extract_day
+ , subq_28.acquired_ds__extract_dow AS customer_id__acquired_ds__extract_dow
+ , subq_28.acquired_ds__extract_doy AS customer_id__acquired_ds__extract_doy
+ , subq_28.customer_third_hop_id__acquired_ds__day AS customer_id__customer_third_hop_id__acquired_ds__day
+ , subq_28.customer_third_hop_id__acquired_ds__week AS customer_id__customer_third_hop_id__acquired_ds__week
+ , subq_28.customer_third_hop_id__acquired_ds__month AS customer_id__customer_third_hop_id__acquired_ds__month
+ , subq_28.customer_third_hop_id__acquired_ds__quarter AS customer_id__customer_third_hop_id__acquired_ds__quarter
+ , subq_28.customer_third_hop_id__acquired_ds__year AS customer_id__customer_third_hop_id__acquired_ds__year
+ , subq_28.customer_third_hop_id__acquired_ds__extract_year AS customer_id__customer_third_hop_id__acquired_ds__extract_year
+ , subq_28.customer_third_hop_id__acquired_ds__extract_quarter AS customer_id__customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_28.customer_third_hop_id__acquired_ds__extract_month AS customer_id__customer_third_hop_id__acquired_ds__extract_month
+ , subq_28.customer_third_hop_id__acquired_ds__extract_day AS customer_id__customer_third_hop_id__acquired_ds__extract_day
+ , subq_28.customer_third_hop_id__acquired_ds__extract_dow AS customer_id__customer_third_hop_id__acquired_ds__extract_dow
+ , subq_28.customer_third_hop_id__acquired_ds__extract_doy AS customer_id__customer_third_hop_id__acquired_ds__extract_doy
+ , subq_28.metric_time__day AS customer_id__metric_time__day
+ , subq_28.metric_time__week AS customer_id__metric_time__week
+ , subq_28.metric_time__month AS customer_id__metric_time__month
+ , subq_28.metric_time__quarter AS customer_id__metric_time__quarter
+ , subq_28.metric_time__year AS customer_id__metric_time__year
+ , subq_28.metric_time__extract_year AS customer_id__metric_time__extract_year
+ , subq_28.metric_time__extract_quarter AS customer_id__metric_time__extract_quarter
+ , subq_28.metric_time__extract_month AS customer_id__metric_time__extract_month
+ , subq_28.metric_time__extract_day AS customer_id__metric_time__extract_day
+ , subq_28.metric_time__extract_dow AS customer_id__metric_time__extract_dow
+ , subq_28.metric_time__extract_doy AS customer_id__metric_time__extract_doy
+ , subq_25.account_id AS account_id
+ , subq_25.customer_id AS customer_id
+ , subq_25.account_id__customer_id AS account_id__customer_id
+ , subq_25.bridge_account__account_id AS bridge_account__account_id
+ , subq_25.bridge_account__customer_id AS bridge_account__customer_id
+ , subq_28.customer_third_hop_id AS customer_id__customer_third_hop_id
+ , subq_28.customer_third_hop_id__customer_id AS customer_id__customer_third_hop_id__customer_id
+ , subq_25.extra_dim AS extra_dim
+ , subq_25.account_id__extra_dim AS account_id__extra_dim
+ , subq_25.bridge_account__extra_dim AS bridge_account__extra_dim
+ , subq_28.country AS customer_id__country
+ , subq_28.customer_third_hop_id__country AS customer_id__customer_third_hop_id__country
+ , subq_25.account_customer_combos AS account_customer_combos
+ FROM (
+ -- Metric Time Dimension 'ds_partitioned'
+ SELECT
+ subq_24.ds_partitioned__day
+ , subq_24.ds_partitioned__week
+ , subq_24.ds_partitioned__month
+ , subq_24.ds_partitioned__quarter
+ , subq_24.ds_partitioned__year
+ , subq_24.ds_partitioned__extract_year
+ , subq_24.ds_partitioned__extract_quarter
+ , subq_24.ds_partitioned__extract_month
+ , subq_24.ds_partitioned__extract_day
+ , subq_24.ds_partitioned__extract_dow
+ , subq_24.ds_partitioned__extract_doy
+ , subq_24.account_id__ds_partitioned__day
+ , subq_24.account_id__ds_partitioned__week
+ , subq_24.account_id__ds_partitioned__month
+ , subq_24.account_id__ds_partitioned__quarter
+ , subq_24.account_id__ds_partitioned__year
+ , subq_24.account_id__ds_partitioned__extract_year
+ , subq_24.account_id__ds_partitioned__extract_quarter
+ , subq_24.account_id__ds_partitioned__extract_month
+ , subq_24.account_id__ds_partitioned__extract_day
+ , subq_24.account_id__ds_partitioned__extract_dow
+ , subq_24.account_id__ds_partitioned__extract_doy
+ , subq_24.bridge_account__ds_partitioned__day
+ , subq_24.bridge_account__ds_partitioned__week
+ , subq_24.bridge_account__ds_partitioned__month
+ , subq_24.bridge_account__ds_partitioned__quarter
+ , subq_24.bridge_account__ds_partitioned__year
+ , subq_24.bridge_account__ds_partitioned__extract_year
+ , subq_24.bridge_account__ds_partitioned__extract_quarter
+ , subq_24.bridge_account__ds_partitioned__extract_month
+ , subq_24.bridge_account__ds_partitioned__extract_day
+ , subq_24.bridge_account__ds_partitioned__extract_dow
+ , subq_24.bridge_account__ds_partitioned__extract_doy
+ , subq_24.ds_partitioned__day AS metric_time__day
+ , subq_24.ds_partitioned__week AS metric_time__week
+ , subq_24.ds_partitioned__month AS metric_time__month
+ , subq_24.ds_partitioned__quarter AS metric_time__quarter
+ , subq_24.ds_partitioned__year AS metric_time__year
+ , subq_24.ds_partitioned__extract_year AS metric_time__extract_year
+ , subq_24.ds_partitioned__extract_quarter AS metric_time__extract_quarter
+ , subq_24.ds_partitioned__extract_month AS metric_time__extract_month
+ , subq_24.ds_partitioned__extract_day AS metric_time__extract_day
+ , subq_24.ds_partitioned__extract_dow AS metric_time__extract_dow
+ , subq_24.ds_partitioned__extract_doy AS metric_time__extract_doy
+ , subq_24.account_id
+ , subq_24.customer_id
+ , subq_24.account_id__customer_id
+ , subq_24.bridge_account__account_id
+ , subq_24.bridge_account__customer_id
+ , subq_24.extra_dim
+ , subq_24.account_id__extra_dim
+ , subq_24.bridge_account__extra_dim
+ , subq_24.account_customer_combos
+ FROM (
+ -- Read Elements From Semantic Model 'bridge_table'
+ SELECT
+ account_id || customer_id AS account_customer_combos
+ , bridge_table_src_22000.extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS account_id__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy
+ , bridge_table_src_22000.account_id
+ , bridge_table_src_22000.customer_id
+ , bridge_table_src_22000.customer_id AS account_id__customer_id
+ , bridge_table_src_22000.account_id AS bridge_account__account_id
+ , bridge_table_src_22000.customer_id AS bridge_account__customer_id
+ FROM ***************************.bridge_table bridge_table_src_22000
+ ) subq_24
+ ) subq_25
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: [
+ -- 'country',
+ -- 'customer_id__country',
+ -- 'customer_third_hop_id__country',
+ -- 'acquired_ds__day',
+ -- 'acquired_ds__week',
+ -- 'acquired_ds__month',
+ -- 'acquired_ds__quarter',
+ -- 'acquired_ds__year',
+ -- 'acquired_ds__extract_year',
+ -- 'acquired_ds__extract_quarter',
+ -- 'acquired_ds__extract_month',
+ -- 'acquired_ds__extract_day',
+ -- 'acquired_ds__extract_dow',
+ -- 'acquired_ds__extract_doy',
+ -- 'customer_id__acquired_ds__day',
+ -- 'customer_id__acquired_ds__week',
+ -- 'customer_id__acquired_ds__month',
+ -- 'customer_id__acquired_ds__quarter',
+ -- 'customer_id__acquired_ds__year',
+ -- 'customer_id__acquired_ds__extract_year',
+ -- 'customer_id__acquired_ds__extract_quarter',
+ -- 'customer_id__acquired_ds__extract_month',
+ -- 'customer_id__acquired_ds__extract_day',
+ -- 'customer_id__acquired_ds__extract_dow',
+ -- 'customer_id__acquired_ds__extract_doy',
+ -- 'customer_third_hop_id__acquired_ds__day',
+ -- 'customer_third_hop_id__acquired_ds__week',
+ -- 'customer_third_hop_id__acquired_ds__month',
+ -- 'customer_third_hop_id__acquired_ds__quarter',
+ -- 'customer_third_hop_id__acquired_ds__year',
+ -- 'customer_third_hop_id__acquired_ds__extract_year',
+ -- 'customer_third_hop_id__acquired_ds__extract_quarter',
+ -- 'customer_third_hop_id__acquired_ds__extract_month',
+ -- 'customer_third_hop_id__acquired_ds__extract_day',
+ -- 'customer_third_hop_id__acquired_ds__extract_dow',
+ -- 'customer_third_hop_id__acquired_ds__extract_doy',
+ -- 'metric_time__day',
+ -- 'metric_time__week',
+ -- 'metric_time__month',
+ -- 'metric_time__quarter',
+ -- 'metric_time__year',
+ -- 'metric_time__extract_year',
+ -- 'metric_time__extract_quarter',
+ -- 'metric_time__extract_month',
+ -- 'metric_time__extract_day',
+ -- 'metric_time__extract_dow',
+ -- 'metric_time__extract_doy',
+ -- 'customer_id',
+ -- 'customer_third_hop_id',
+ -- 'customer_id__customer_third_hop_id',
+ -- 'customer_third_hop_id__customer_id',
+ -- ]
+ SELECT
+ subq_27.acquired_ds__day
+ , subq_27.acquired_ds__week
+ , subq_27.acquired_ds__month
+ , subq_27.acquired_ds__quarter
+ , subq_27.acquired_ds__year
+ , subq_27.acquired_ds__extract_year
+ , subq_27.acquired_ds__extract_quarter
+ , subq_27.acquired_ds__extract_month
+ , subq_27.acquired_ds__extract_day
+ , subq_27.acquired_ds__extract_dow
+ , subq_27.acquired_ds__extract_doy
+ , subq_27.customer_id__acquired_ds__day
+ , subq_27.customer_id__acquired_ds__week
+ , subq_27.customer_id__acquired_ds__month
+ , subq_27.customer_id__acquired_ds__quarter
+ , subq_27.customer_id__acquired_ds__year
+ , subq_27.customer_id__acquired_ds__extract_year
+ , subq_27.customer_id__acquired_ds__extract_quarter
+ , subq_27.customer_id__acquired_ds__extract_month
+ , subq_27.customer_id__acquired_ds__extract_day
+ , subq_27.customer_id__acquired_ds__extract_dow
+ , subq_27.customer_id__acquired_ds__extract_doy
+ , subq_27.customer_third_hop_id__acquired_ds__day
+ , subq_27.customer_third_hop_id__acquired_ds__week
+ , subq_27.customer_third_hop_id__acquired_ds__month
+ , subq_27.customer_third_hop_id__acquired_ds__quarter
+ , subq_27.customer_third_hop_id__acquired_ds__year
+ , subq_27.customer_third_hop_id__acquired_ds__extract_year
+ , subq_27.customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_27.customer_third_hop_id__acquired_ds__extract_month
+ , subq_27.customer_third_hop_id__acquired_ds__extract_day
+ , subq_27.customer_third_hop_id__acquired_ds__extract_dow
+ , subq_27.customer_third_hop_id__acquired_ds__extract_doy
+ , subq_27.metric_time__day
+ , subq_27.metric_time__week
+ , subq_27.metric_time__month
+ , subq_27.metric_time__quarter
+ , subq_27.metric_time__year
+ , subq_27.metric_time__extract_year
+ , subq_27.metric_time__extract_quarter
+ , subq_27.metric_time__extract_month
+ , subq_27.metric_time__extract_day
+ , subq_27.metric_time__extract_dow
+ , subq_27.metric_time__extract_doy
+ , subq_27.customer_id
+ , subq_27.customer_third_hop_id
+ , subq_27.customer_id__customer_third_hop_id
+ , subq_27.customer_third_hop_id__customer_id
+ , subq_27.country
+ , subq_27.customer_id__country
+ , subq_27.customer_third_hop_id__country
+ FROM (
+ -- Metric Time Dimension 'acquired_ds'
+ SELECT
+ subq_26.acquired_ds__day
+ , subq_26.acquired_ds__week
+ , subq_26.acquired_ds__month
+ , subq_26.acquired_ds__quarter
+ , subq_26.acquired_ds__year
+ , subq_26.acquired_ds__extract_year
+ , subq_26.acquired_ds__extract_quarter
+ , subq_26.acquired_ds__extract_month
+ , subq_26.acquired_ds__extract_day
+ , subq_26.acquired_ds__extract_dow
+ , subq_26.acquired_ds__extract_doy
+ , subq_26.customer_id__acquired_ds__day
+ , subq_26.customer_id__acquired_ds__week
+ , subq_26.customer_id__acquired_ds__month
+ , subq_26.customer_id__acquired_ds__quarter
+ , subq_26.customer_id__acquired_ds__year
+ , subq_26.customer_id__acquired_ds__extract_year
+ , subq_26.customer_id__acquired_ds__extract_quarter
+ , subq_26.customer_id__acquired_ds__extract_month
+ , subq_26.customer_id__acquired_ds__extract_day
+ , subq_26.customer_id__acquired_ds__extract_dow
+ , subq_26.customer_id__acquired_ds__extract_doy
+ , subq_26.customer_third_hop_id__acquired_ds__day
+ , subq_26.customer_third_hop_id__acquired_ds__week
+ , subq_26.customer_third_hop_id__acquired_ds__month
+ , subq_26.customer_third_hop_id__acquired_ds__quarter
+ , subq_26.customer_third_hop_id__acquired_ds__year
+ , subq_26.customer_third_hop_id__acquired_ds__extract_year
+ , subq_26.customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_26.customer_third_hop_id__acquired_ds__extract_month
+ , subq_26.customer_third_hop_id__acquired_ds__extract_day
+ , subq_26.customer_third_hop_id__acquired_ds__extract_dow
+ , subq_26.customer_third_hop_id__acquired_ds__extract_doy
+ , subq_26.acquired_ds__day AS metric_time__day
+ , subq_26.acquired_ds__week AS metric_time__week
+ , subq_26.acquired_ds__month AS metric_time__month
+ , subq_26.acquired_ds__quarter AS metric_time__quarter
+ , subq_26.acquired_ds__year AS metric_time__year
+ , subq_26.acquired_ds__extract_year AS metric_time__extract_year
+ , subq_26.acquired_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_26.acquired_ds__extract_month AS metric_time__extract_month
+ , subq_26.acquired_ds__extract_day AS metric_time__extract_day
+ , subq_26.acquired_ds__extract_dow AS metric_time__extract_dow
+ , subq_26.acquired_ds__extract_doy AS metric_time__extract_doy
+ , subq_26.customer_id
+ , subq_26.customer_third_hop_id
+ , subq_26.customer_id__customer_third_hop_id
+ , subq_26.customer_third_hop_id__customer_id
+ , subq_26.country
+ , subq_26.customer_id__country
+ , subq_26.customer_third_hop_id__country
+ , subq_26.customers_with_other_data
+ FROM (
+ -- Read Elements From Semantic Model 'customer_other_data'
+ SELECT
+ 1 AS customers_with_other_data
+ , customer_other_data_src_22000.country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_third_hop_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.customer_id
+ , customer_other_data_src_22000.customer_third_hop_id
+ , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id
+ , customer_other_data_src_22000.customer_id AS customer_third_hop_id__customer_id
+ FROM ***************************.customer_other_data customer_other_data_src_22000
+ ) subq_26
+ ) subq_27
+ ) subq_28
+ ON
+ subq_25.customer_id = subq_28.customer_id
+ ) subq_29
+ ) subq_30
+ ON
+ (
+ subq_23.account_id = subq_30.account_id
+ ) AND (
+ subq_23.ds_partitioned__day = subq_30.ds_partitioned__day
+ )
+ ) subq_31
+ ) subq_32
+ GROUP BY
+ subq_32.account_id__customer_id__customer_third_hop_id
+ ) subq_33
+ ) subq_34
+ ) subq_35
+ ON
+ subq_20.customer_third_hop_id = subq_35.account_id__customer_id__customer_third_hop_id
+ ) subq_36
+ ) subq_37
+ WHERE customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count > 2
+ ) subq_38
+ ) subq_39
+) subq_40
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Databricks/test_inner_query_multi_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Databricks/test_inner_query_multi_hop__plan0_optimized.sql
new file mode 100644
index 0000000000..d195b8867f
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Databricks/test_inner_query_multi_hop__plan0_optimized.sql
@@ -0,0 +1,49 @@
+-- Constrain Output with WHERE
+-- Pass Only Elements: ['third_hop_count',]
+-- Aggregate Measures
+-- Compute Metrics via Expressions
+SELECT
+ COUNT(DISTINCT third_hop_count) AS third_hop_count
+FROM (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_58.account_id__customer_id__customer_third_hop_id__txn_count AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ LEFT OUTER JOIN (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['txn_count', 'account_id__customer_id__customer_third_hop_id']
+ -- Aggregate Measures
+ -- Compute Metrics via Expressions
+ -- Pass Only Elements: ['account_id__customer_id__customer_third_hop_id', 'account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_53.customer_id__customer_third_hop_id AS account_id__customer_id__customer_third_hop_id
+ , SUM(account_month_txns_src_22000.txn_count) AS account_id__customer_id__customer_third_hop_id__txn_count
+ FROM ***************************.account_month_txns account_month_txns_src_22000
+ LEFT OUTER JOIN (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['ds_partitioned__day', 'account_id', 'customer_id__customer_third_hop_id']
+ SELECT
+ DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , bridge_table_src_22000.account_id AS account_id
+ , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id
+ FROM ***************************.bridge_table bridge_table_src_22000
+ LEFT OUTER JOIN
+ ***************************.customer_other_data customer_other_data_src_22000
+ ON
+ bridge_table_src_22000.customer_id = customer_other_data_src_22000.customer_id
+ ) subq_53
+ ON
+ (
+ account_month_txns_src_22000.account_id = subq_53.account_id
+ ) AND (
+ DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_53.ds_partitioned__day
+ )
+ GROUP BY
+ subq_53.customer_id__customer_third_hop_id
+ ) subq_58
+ ON
+ third_hop_table_src_22000.customer_third_hop_id = subq_58.account_id__customer_id__customer_third_hop_id
+) subq_60
+WHERE customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count > 2
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Databricks/test_inner_query_single_hop__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Databricks/test_inner_query_single_hop__plan0.sql
new file mode 100644
index 0000000000..41388a6d9b
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Databricks/test_inner_query_single_hop__plan0.sql
@@ -0,0 +1,257 @@
+-- Compute Metrics via Expressions
+SELECT
+ subq_21.third_hop_count
+FROM (
+ -- Aggregate Measures
+ SELECT
+ COUNT(DISTINCT subq_20.third_hop_count) AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count',]
+ SELECT
+ subq_19.third_hop_count
+ FROM (
+ -- Constrain Output with WHERE
+ SELECT
+ subq_18.customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , subq_18.third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ subq_17.customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , subq_17.third_hop_count
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_8.customer_third_hop_id AS customer_third_hop_id
+ , subq_16.customer_id__customer_third_hop_id AS customer_third_hop_id__customer_id__customer_third_hop_id
+ , subq_16.customer_id__customer_third_hop_id__paraguayan_customers AS customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , subq_8.third_hop_count AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id']
+ SELECT
+ subq_7.customer_third_hop_id
+ , subq_7.third_hop_count
+ FROM (
+ -- Metric Time Dimension 'third_hop_ds'
+ SELECT
+ subq_6.third_hop_ds__day
+ , subq_6.third_hop_ds__week
+ , subq_6.third_hop_ds__month
+ , subq_6.third_hop_ds__quarter
+ , subq_6.third_hop_ds__year
+ , subq_6.third_hop_ds__extract_year
+ , subq_6.third_hop_ds__extract_quarter
+ , subq_6.third_hop_ds__extract_month
+ , subq_6.third_hop_ds__extract_day
+ , subq_6.third_hop_ds__extract_dow
+ , subq_6.third_hop_ds__extract_doy
+ , subq_6.customer_third_hop_id__third_hop_ds__day
+ , subq_6.customer_third_hop_id__third_hop_ds__week
+ , subq_6.customer_third_hop_id__third_hop_ds__month
+ , subq_6.customer_third_hop_id__third_hop_ds__quarter
+ , subq_6.customer_third_hop_id__third_hop_ds__year
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_year
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_quarter
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_month
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_day
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_dow
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_doy
+ , subq_6.third_hop_ds__day AS metric_time__day
+ , subq_6.third_hop_ds__week AS metric_time__week
+ , subq_6.third_hop_ds__month AS metric_time__month
+ , subq_6.third_hop_ds__quarter AS metric_time__quarter
+ , subq_6.third_hop_ds__year AS metric_time__year
+ , subq_6.third_hop_ds__extract_year AS metric_time__extract_year
+ , subq_6.third_hop_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_6.third_hop_ds__extract_month AS metric_time__extract_month
+ , subq_6.third_hop_ds__extract_day AS metric_time__extract_day
+ , subq_6.third_hop_ds__extract_dow AS metric_time__extract_dow
+ , subq_6.third_hop_ds__extract_doy AS metric_time__extract_doy
+ , subq_6.customer_third_hop_id
+ , subq_6.value
+ , subq_6.customer_third_hop_id__value
+ , subq_6.third_hop_count
+ FROM (
+ -- Read Elements From Semantic Model 'third_hop_table'
+ SELECT
+ third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ , third_hop_table_src_22000.value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_doy
+ , third_hop_table_src_22000.value AS customer_third_hop_id__value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_doy
+ , third_hop_table_src_22000.customer_third_hop_id
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ ) subq_6
+ ) subq_7
+ ) subq_8
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: ['customer_id__customer_third_hop_id', 'customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ subq_15.customer_id__customer_third_hop_id
+ , subq_15.customer_id__customer_third_hop_id__paraguayan_customers
+ FROM (
+ -- Compute Metrics via Expressions
+ SELECT
+ subq_14.customer_id__customer_third_hop_id
+ , subq_14.customers_with_other_data AS customer_id__customer_third_hop_id__paraguayan_customers
+ FROM (
+ -- Aggregate Measures
+ SELECT
+ subq_13.customer_id__customer_third_hop_id
+ , SUM(subq_13.customers_with_other_data) AS customers_with_other_data
+ FROM (
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__customer_third_hop_id']
+ SELECT
+ subq_12.customer_id__customer_third_hop_id
+ , subq_12.customers_with_other_data
+ FROM (
+ -- Constrain Output with WHERE
+ SELECT
+ subq_11.customer_id__customer_third_hop_id
+ , subq_11.customer_id__country
+ , subq_11.customers_with_other_data
+ FROM (
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id']
+ SELECT
+ subq_10.customer_id__customer_third_hop_id
+ , subq_10.customer_id__country
+ , subq_10.customers_with_other_data
+ FROM (
+ -- Metric Time Dimension 'acquired_ds'
+ SELECT
+ subq_9.acquired_ds__day
+ , subq_9.acquired_ds__week
+ , subq_9.acquired_ds__month
+ , subq_9.acquired_ds__quarter
+ , subq_9.acquired_ds__year
+ , subq_9.acquired_ds__extract_year
+ , subq_9.acquired_ds__extract_quarter
+ , subq_9.acquired_ds__extract_month
+ , subq_9.acquired_ds__extract_day
+ , subq_9.acquired_ds__extract_dow
+ , subq_9.acquired_ds__extract_doy
+ , subq_9.customer_id__acquired_ds__day
+ , subq_9.customer_id__acquired_ds__week
+ , subq_9.customer_id__acquired_ds__month
+ , subq_9.customer_id__acquired_ds__quarter
+ , subq_9.customer_id__acquired_ds__year
+ , subq_9.customer_id__acquired_ds__extract_year
+ , subq_9.customer_id__acquired_ds__extract_quarter
+ , subq_9.customer_id__acquired_ds__extract_month
+ , subq_9.customer_id__acquired_ds__extract_day
+ , subq_9.customer_id__acquired_ds__extract_dow
+ , subq_9.customer_id__acquired_ds__extract_doy
+ , subq_9.customer_third_hop_id__acquired_ds__day
+ , subq_9.customer_third_hop_id__acquired_ds__week
+ , subq_9.customer_third_hop_id__acquired_ds__month
+ , subq_9.customer_third_hop_id__acquired_ds__quarter
+ , subq_9.customer_third_hop_id__acquired_ds__year
+ , subq_9.customer_third_hop_id__acquired_ds__extract_year
+ , subq_9.customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_9.customer_third_hop_id__acquired_ds__extract_month
+ , subq_9.customer_third_hop_id__acquired_ds__extract_day
+ , subq_9.customer_third_hop_id__acquired_ds__extract_dow
+ , subq_9.customer_third_hop_id__acquired_ds__extract_doy
+ , subq_9.acquired_ds__day AS metric_time__day
+ , subq_9.acquired_ds__week AS metric_time__week
+ , subq_9.acquired_ds__month AS metric_time__month
+ , subq_9.acquired_ds__quarter AS metric_time__quarter
+ , subq_9.acquired_ds__year AS metric_time__year
+ , subq_9.acquired_ds__extract_year AS metric_time__extract_year
+ , subq_9.acquired_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.acquired_ds__extract_month AS metric_time__extract_month
+ , subq_9.acquired_ds__extract_day AS metric_time__extract_day
+ , subq_9.acquired_ds__extract_dow AS metric_time__extract_dow
+ , subq_9.acquired_ds__extract_doy AS metric_time__extract_doy
+ , subq_9.customer_id
+ , subq_9.customer_third_hop_id
+ , subq_9.customer_id__customer_third_hop_id
+ , subq_9.customer_third_hop_id__customer_id
+ , subq_9.country
+ , subq_9.customer_id__country
+ , subq_9.customer_third_hop_id__country
+ , subq_9.customers_with_other_data
+ FROM (
+ -- Read Elements From Semantic Model 'customer_other_data'
+ SELECT
+ 1 AS customers_with_other_data
+ , customer_other_data_src_22000.country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_third_hop_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.customer_id
+ , customer_other_data_src_22000.customer_third_hop_id
+ , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id
+ , customer_other_data_src_22000.customer_id AS customer_third_hop_id__customer_id
+ FROM ***************************.customer_other_data customer_other_data_src_22000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+ WHERE customer_id__country = 'paraguay'
+ ) subq_12
+ ) subq_13
+ GROUP BY
+ subq_13.customer_id__customer_third_hop_id
+ ) subq_14
+ ) subq_15
+ ) subq_16
+ ON
+ subq_8.customer_third_hop_id = subq_16.customer_id__customer_third_hop_id
+ ) subq_17
+ ) subq_18
+ WHERE customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers > 0
+ ) subq_19
+ ) subq_20
+) subq_21
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Databricks/test_inner_query_single_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Databricks/test_inner_query_single_hop__plan0_optimized.sql
new file mode 100644
index 0000000000..2ad52ec04c
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Databricks/test_inner_query_single_hop__plan0_optimized.sql
@@ -0,0 +1,40 @@
+-- Constrain Output with WHERE
+-- Pass Only Elements: ['third_hop_count',]
+-- Aggregate Measures
+-- Compute Metrics via Expressions
+SELECT
+ COUNT(DISTINCT third_hop_count) AS third_hop_count
+FROM (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ subq_32.customer_id__customer_third_hop_id__paraguayan_customers AS customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ LEFT OUTER JOIN (
+ -- Constrain Output with WHERE
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__customer_third_hop_id']
+ -- Aggregate Measures
+ -- Compute Metrics via Expressions
+ -- Pass Only Elements: ['customer_id__customer_third_hop_id', 'customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ customer_id__customer_third_hop_id
+ , SUM(customers_with_other_data) AS customer_id__customer_third_hop_id__paraguayan_customers
+ FROM (
+ -- Read Elements From Semantic Model 'customer_other_data'
+ -- Metric Time Dimension 'acquired_ds'
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id']
+ SELECT
+ customer_third_hop_id AS customer_id__customer_third_hop_id
+ , country AS customer_id__country
+ , 1 AS customers_with_other_data
+ FROM ***************************.customer_other_data customer_other_data_src_22000
+ ) subq_27
+ WHERE customer_id__country = 'paraguay'
+ GROUP BY
+ customer_id__customer_third_hop_id
+ ) subq_32
+ ON
+ third_hop_table_src_22000.customer_third_hop_id = subq_32.customer_id__customer_third_hop_id
+) subq_34
+WHERE customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers > 0
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_inner_query_multi_hop__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_inner_query_multi_hop__plan0.sql
new file mode 100644
index 0000000000..7deea353a9
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_inner_query_multi_hop__plan0.sql
@@ -0,0 +1,694 @@
+-- Compute Metrics via Expressions
+SELECT
+ subq_40.third_hop_count
+FROM (
+ -- Aggregate Measures
+ SELECT
+ COUNT(DISTINCT subq_39.third_hop_count) AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count',]
+ SELECT
+ subq_38.third_hop_count
+ FROM (
+ -- Constrain Output with WHERE
+ SELECT
+ subq_37.customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , subq_37.third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_36.customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , subq_36.third_hop_count
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_20.customer_third_hop_id AS customer_third_hop_id
+ , subq_35.account_id__customer_id__customer_third_hop_id AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id
+ , subq_35.account_id__customer_id__customer_third_hop_id__txn_count AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , subq_20.third_hop_count AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id']
+ SELECT
+ subq_19.customer_third_hop_id
+ , subq_19.third_hop_count
+ FROM (
+ -- Metric Time Dimension 'third_hop_ds'
+ SELECT
+ subq_18.third_hop_ds__day
+ , subq_18.third_hop_ds__week
+ , subq_18.third_hop_ds__month
+ , subq_18.third_hop_ds__quarter
+ , subq_18.third_hop_ds__year
+ , subq_18.third_hop_ds__extract_year
+ , subq_18.third_hop_ds__extract_quarter
+ , subq_18.third_hop_ds__extract_month
+ , subq_18.third_hop_ds__extract_day
+ , subq_18.third_hop_ds__extract_dow
+ , subq_18.third_hop_ds__extract_doy
+ , subq_18.customer_third_hop_id__third_hop_ds__day
+ , subq_18.customer_third_hop_id__third_hop_ds__week
+ , subq_18.customer_third_hop_id__third_hop_ds__month
+ , subq_18.customer_third_hop_id__third_hop_ds__quarter
+ , subq_18.customer_third_hop_id__third_hop_ds__year
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_year
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_quarter
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_month
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_day
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_dow
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_doy
+ , subq_18.third_hop_ds__day AS metric_time__day
+ , subq_18.third_hop_ds__week AS metric_time__week
+ , subq_18.third_hop_ds__month AS metric_time__month
+ , subq_18.third_hop_ds__quarter AS metric_time__quarter
+ , subq_18.third_hop_ds__year AS metric_time__year
+ , subq_18.third_hop_ds__extract_year AS metric_time__extract_year
+ , subq_18.third_hop_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_18.third_hop_ds__extract_month AS metric_time__extract_month
+ , subq_18.third_hop_ds__extract_day AS metric_time__extract_day
+ , subq_18.third_hop_ds__extract_dow AS metric_time__extract_dow
+ , subq_18.third_hop_ds__extract_doy AS metric_time__extract_doy
+ , subq_18.customer_third_hop_id
+ , subq_18.value
+ , subq_18.customer_third_hop_id__value
+ , subq_18.third_hop_count
+ FROM (
+ -- Read Elements From Semantic Model 'third_hop_table'
+ SELECT
+ third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ , third_hop_table_src_22000.value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_day
+ , EXTRACT(isodow FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_doy
+ , third_hop_table_src_22000.value AS customer_third_hop_id__value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_day
+ , EXTRACT(isodow FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_doy
+ , third_hop_table_src_22000.customer_third_hop_id
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ ) subq_18
+ ) subq_19
+ ) subq_20
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: ['account_id__customer_id__customer_third_hop_id', 'account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_34.account_id__customer_id__customer_third_hop_id
+ , subq_34.account_id__customer_id__customer_third_hop_id__txn_count
+ FROM (
+ -- Compute Metrics via Expressions
+ SELECT
+ subq_33.account_id__customer_id__customer_third_hop_id
+ , subq_33.txn_count AS account_id__customer_id__customer_third_hop_id__txn_count
+ FROM (
+ -- Aggregate Measures
+ SELECT
+ subq_32.account_id__customer_id__customer_third_hop_id
+ , SUM(subq_32.txn_count) AS txn_count
+ FROM (
+ -- Pass Only Elements: ['txn_count', 'account_id__customer_id__customer_third_hop_id']
+ SELECT
+ subq_31.account_id__customer_id__customer_third_hop_id
+ , subq_31.txn_count
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_23.ds_partitioned__day AS ds_partitioned__day
+ , subq_30.ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_23.account_id AS account_id
+ , subq_30.customer_id__customer_third_hop_id AS account_id__customer_id__customer_third_hop_id
+ , subq_23.txn_count AS txn_count
+ FROM (
+ -- Pass Only Elements: ['txn_count', 'ds_partitioned__day', 'account_id']
+ SELECT
+ subq_22.ds_partitioned__day
+ , subq_22.account_id
+ , subq_22.txn_count
+ FROM (
+ -- Metric Time Dimension 'ds'
+ SELECT
+ subq_21.ds_partitioned__day
+ , subq_21.ds_partitioned__week
+ , subq_21.ds_partitioned__month
+ , subq_21.ds_partitioned__quarter
+ , subq_21.ds_partitioned__year
+ , subq_21.ds_partitioned__extract_year
+ , subq_21.ds_partitioned__extract_quarter
+ , subq_21.ds_partitioned__extract_month
+ , subq_21.ds_partitioned__extract_day
+ , subq_21.ds_partitioned__extract_dow
+ , subq_21.ds_partitioned__extract_doy
+ , subq_21.ds__day
+ , subq_21.ds__week
+ , subq_21.ds__month
+ , subq_21.ds__quarter
+ , subq_21.ds__year
+ , subq_21.ds__extract_year
+ , subq_21.ds__extract_quarter
+ , subq_21.ds__extract_month
+ , subq_21.ds__extract_day
+ , subq_21.ds__extract_dow
+ , subq_21.ds__extract_doy
+ , subq_21.account_id__ds_partitioned__day
+ , subq_21.account_id__ds_partitioned__week
+ , subq_21.account_id__ds_partitioned__month
+ , subq_21.account_id__ds_partitioned__quarter
+ , subq_21.account_id__ds_partitioned__year
+ , subq_21.account_id__ds_partitioned__extract_year
+ , subq_21.account_id__ds_partitioned__extract_quarter
+ , subq_21.account_id__ds_partitioned__extract_month
+ , subq_21.account_id__ds_partitioned__extract_day
+ , subq_21.account_id__ds_partitioned__extract_dow
+ , subq_21.account_id__ds_partitioned__extract_doy
+ , subq_21.account_id__ds__day
+ , subq_21.account_id__ds__week
+ , subq_21.account_id__ds__month
+ , subq_21.account_id__ds__quarter
+ , subq_21.account_id__ds__year
+ , subq_21.account_id__ds__extract_year
+ , subq_21.account_id__ds__extract_quarter
+ , subq_21.account_id__ds__extract_month
+ , subq_21.account_id__ds__extract_day
+ , subq_21.account_id__ds__extract_dow
+ , subq_21.account_id__ds__extract_doy
+ , subq_21.ds__day AS metric_time__day
+ , subq_21.ds__week AS metric_time__week
+ , subq_21.ds__month AS metric_time__month
+ , subq_21.ds__quarter AS metric_time__quarter
+ , subq_21.ds__year AS metric_time__year
+ , subq_21.ds__extract_year AS metric_time__extract_year
+ , subq_21.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_21.ds__extract_month AS metric_time__extract_month
+ , subq_21.ds__extract_day AS metric_time__extract_day
+ , subq_21.ds__extract_dow AS metric_time__extract_dow
+ , subq_21.ds__extract_doy AS metric_time__extract_doy
+ , subq_21.account_id
+ , subq_21.account_month
+ , subq_21.account_id__account_month
+ , subq_21.txn_count
+ FROM (
+ -- Read Elements From Semantic Model 'account_month_txns'
+ SELECT
+ account_month_txns_src_22000.txn_count
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(isodow FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS ds__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS ds__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS ds__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS ds__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS ds__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds) AS ds__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS ds__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds) AS ds__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM account_month_txns_src_22000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS ds__extract_doy
+ , account_month_txns_src_22000.account_month
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
+ , EXTRACT(isodow FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS account_id__ds__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS account_id__ds__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS account_id__ds__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS account_id__ds__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS account_id__ds__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_day
+ , EXTRACT(isodow FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_doy
+ , account_month_txns_src_22000.account_month AS account_id__account_month
+ , account_month_txns_src_22000.account_id
+ FROM ***************************.account_month_txns account_month_txns_src_22000
+ ) subq_21
+ ) subq_22
+ ) subq_23
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: ['ds_partitioned__day', 'account_id', 'customer_id__customer_third_hop_id']
+ SELECT
+ subq_29.ds_partitioned__day
+ , subq_29.account_id
+ , subq_29.customer_id__customer_third_hop_id
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_25.ds_partitioned__day AS ds_partitioned__day
+ , subq_25.ds_partitioned__week AS ds_partitioned__week
+ , subq_25.ds_partitioned__month AS ds_partitioned__month
+ , subq_25.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_25.ds_partitioned__year AS ds_partitioned__year
+ , subq_25.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_25.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_25.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_25.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_25.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_25.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_25.account_id__ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_25.account_id__ds_partitioned__week AS account_id__ds_partitioned__week
+ , subq_25.account_id__ds_partitioned__month AS account_id__ds_partitioned__month
+ , subq_25.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter
+ , subq_25.account_id__ds_partitioned__year AS account_id__ds_partitioned__year
+ , subq_25.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year
+ , subq_25.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter
+ , subq_25.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month
+ , subq_25.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day
+ , subq_25.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow
+ , subq_25.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy
+ , subq_25.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day
+ , subq_25.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week
+ , subq_25.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month
+ , subq_25.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter
+ , subq_25.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year
+ , subq_25.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year
+ , subq_25.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter
+ , subq_25.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month
+ , subq_25.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day
+ , subq_25.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow
+ , subq_25.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy
+ , subq_25.metric_time__day AS metric_time__day
+ , subq_25.metric_time__week AS metric_time__week
+ , subq_25.metric_time__month AS metric_time__month
+ , subq_25.metric_time__quarter AS metric_time__quarter
+ , subq_25.metric_time__year AS metric_time__year
+ , subq_25.metric_time__extract_year AS metric_time__extract_year
+ , subq_25.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_25.metric_time__extract_month AS metric_time__extract_month
+ , subq_25.metric_time__extract_day AS metric_time__extract_day
+ , subq_25.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_25.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_28.acquired_ds__day AS customer_id__acquired_ds__day
+ , subq_28.acquired_ds__week AS customer_id__acquired_ds__week
+ , subq_28.acquired_ds__month AS customer_id__acquired_ds__month
+ , subq_28.acquired_ds__quarter AS customer_id__acquired_ds__quarter
+ , subq_28.acquired_ds__year AS customer_id__acquired_ds__year
+ , subq_28.acquired_ds__extract_year AS customer_id__acquired_ds__extract_year
+ , subq_28.acquired_ds__extract_quarter AS customer_id__acquired_ds__extract_quarter
+ , subq_28.acquired_ds__extract_month AS customer_id__acquired_ds__extract_month
+ , subq_28.acquired_ds__extract_day AS customer_id__acquired_ds__extract_day
+ , subq_28.acquired_ds__extract_dow AS customer_id__acquired_ds__extract_dow
+ , subq_28.acquired_ds__extract_doy AS customer_id__acquired_ds__extract_doy
+ , subq_28.customer_third_hop_id__acquired_ds__day AS customer_id__customer_third_hop_id__acquired_ds__day
+ , subq_28.customer_third_hop_id__acquired_ds__week AS customer_id__customer_third_hop_id__acquired_ds__week
+ , subq_28.customer_third_hop_id__acquired_ds__month AS customer_id__customer_third_hop_id__acquired_ds__month
+ , subq_28.customer_third_hop_id__acquired_ds__quarter AS customer_id__customer_third_hop_id__acquired_ds__quarter
+ , subq_28.customer_third_hop_id__acquired_ds__year AS customer_id__customer_third_hop_id__acquired_ds__year
+ , subq_28.customer_third_hop_id__acquired_ds__extract_year AS customer_id__customer_third_hop_id__acquired_ds__extract_year
+ , subq_28.customer_third_hop_id__acquired_ds__extract_quarter AS customer_id__customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_28.customer_third_hop_id__acquired_ds__extract_month AS customer_id__customer_third_hop_id__acquired_ds__extract_month
+ , subq_28.customer_third_hop_id__acquired_ds__extract_day AS customer_id__customer_third_hop_id__acquired_ds__extract_day
+ , subq_28.customer_third_hop_id__acquired_ds__extract_dow AS customer_id__customer_third_hop_id__acquired_ds__extract_dow
+ , subq_28.customer_third_hop_id__acquired_ds__extract_doy AS customer_id__customer_third_hop_id__acquired_ds__extract_doy
+ , subq_28.metric_time__day AS customer_id__metric_time__day
+ , subq_28.metric_time__week AS customer_id__metric_time__week
+ , subq_28.metric_time__month AS customer_id__metric_time__month
+ , subq_28.metric_time__quarter AS customer_id__metric_time__quarter
+ , subq_28.metric_time__year AS customer_id__metric_time__year
+ , subq_28.metric_time__extract_year AS customer_id__metric_time__extract_year
+ , subq_28.metric_time__extract_quarter AS customer_id__metric_time__extract_quarter
+ , subq_28.metric_time__extract_month AS customer_id__metric_time__extract_month
+ , subq_28.metric_time__extract_day AS customer_id__metric_time__extract_day
+ , subq_28.metric_time__extract_dow AS customer_id__metric_time__extract_dow
+ , subq_28.metric_time__extract_doy AS customer_id__metric_time__extract_doy
+ , subq_25.account_id AS account_id
+ , subq_25.customer_id AS customer_id
+ , subq_25.account_id__customer_id AS account_id__customer_id
+ , subq_25.bridge_account__account_id AS bridge_account__account_id
+ , subq_25.bridge_account__customer_id AS bridge_account__customer_id
+ , subq_28.customer_third_hop_id AS customer_id__customer_third_hop_id
+ , subq_28.customer_third_hop_id__customer_id AS customer_id__customer_third_hop_id__customer_id
+ , subq_25.extra_dim AS extra_dim
+ , subq_25.account_id__extra_dim AS account_id__extra_dim
+ , subq_25.bridge_account__extra_dim AS bridge_account__extra_dim
+ , subq_28.country AS customer_id__country
+ , subq_28.customer_third_hop_id__country AS customer_id__customer_third_hop_id__country
+ , subq_25.account_customer_combos AS account_customer_combos
+ FROM (
+ -- Metric Time Dimension 'ds_partitioned'
+ SELECT
+ subq_24.ds_partitioned__day
+ , subq_24.ds_partitioned__week
+ , subq_24.ds_partitioned__month
+ , subq_24.ds_partitioned__quarter
+ , subq_24.ds_partitioned__year
+ , subq_24.ds_partitioned__extract_year
+ , subq_24.ds_partitioned__extract_quarter
+ , subq_24.ds_partitioned__extract_month
+ , subq_24.ds_partitioned__extract_day
+ , subq_24.ds_partitioned__extract_dow
+ , subq_24.ds_partitioned__extract_doy
+ , subq_24.account_id__ds_partitioned__day
+ , subq_24.account_id__ds_partitioned__week
+ , subq_24.account_id__ds_partitioned__month
+ , subq_24.account_id__ds_partitioned__quarter
+ , subq_24.account_id__ds_partitioned__year
+ , subq_24.account_id__ds_partitioned__extract_year
+ , subq_24.account_id__ds_partitioned__extract_quarter
+ , subq_24.account_id__ds_partitioned__extract_month
+ , subq_24.account_id__ds_partitioned__extract_day
+ , subq_24.account_id__ds_partitioned__extract_dow
+ , subq_24.account_id__ds_partitioned__extract_doy
+ , subq_24.bridge_account__ds_partitioned__day
+ , subq_24.bridge_account__ds_partitioned__week
+ , subq_24.bridge_account__ds_partitioned__month
+ , subq_24.bridge_account__ds_partitioned__quarter
+ , subq_24.bridge_account__ds_partitioned__year
+ , subq_24.bridge_account__ds_partitioned__extract_year
+ , subq_24.bridge_account__ds_partitioned__extract_quarter
+ , subq_24.bridge_account__ds_partitioned__extract_month
+ , subq_24.bridge_account__ds_partitioned__extract_day
+ , subq_24.bridge_account__ds_partitioned__extract_dow
+ , subq_24.bridge_account__ds_partitioned__extract_doy
+ , subq_24.ds_partitioned__day AS metric_time__day
+ , subq_24.ds_partitioned__week AS metric_time__week
+ , subq_24.ds_partitioned__month AS metric_time__month
+ , subq_24.ds_partitioned__quarter AS metric_time__quarter
+ , subq_24.ds_partitioned__year AS metric_time__year
+ , subq_24.ds_partitioned__extract_year AS metric_time__extract_year
+ , subq_24.ds_partitioned__extract_quarter AS metric_time__extract_quarter
+ , subq_24.ds_partitioned__extract_month AS metric_time__extract_month
+ , subq_24.ds_partitioned__extract_day AS metric_time__extract_day
+ , subq_24.ds_partitioned__extract_dow AS metric_time__extract_dow
+ , subq_24.ds_partitioned__extract_doy AS metric_time__extract_doy
+ , subq_24.account_id
+ , subq_24.customer_id
+ , subq_24.account_id__customer_id
+ , subq_24.bridge_account__account_id
+ , subq_24.bridge_account__customer_id
+ , subq_24.extra_dim
+ , subq_24.account_id__extra_dim
+ , subq_24.bridge_account__extra_dim
+ , subq_24.account_customer_combos
+ FROM (
+ -- Read Elements From Semantic Model 'bridge_table'
+ SELECT
+ account_id || customer_id AS account_customer_combos
+ , bridge_table_src_22000.extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(isodow FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS account_id__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
+ , EXTRACT(isodow FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_day
+ , EXTRACT(isodow FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy
+ , bridge_table_src_22000.account_id
+ , bridge_table_src_22000.customer_id
+ , bridge_table_src_22000.customer_id AS account_id__customer_id
+ , bridge_table_src_22000.account_id AS bridge_account__account_id
+ , bridge_table_src_22000.customer_id AS bridge_account__customer_id
+ FROM ***************************.bridge_table bridge_table_src_22000
+ ) subq_24
+ ) subq_25
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: [
+ -- 'country',
+ -- 'customer_id__country',
+ -- 'customer_third_hop_id__country',
+ -- 'acquired_ds__day',
+ -- 'acquired_ds__week',
+ -- 'acquired_ds__month',
+ -- 'acquired_ds__quarter',
+ -- 'acquired_ds__year',
+ -- 'acquired_ds__extract_year',
+ -- 'acquired_ds__extract_quarter',
+ -- 'acquired_ds__extract_month',
+ -- 'acquired_ds__extract_day',
+ -- 'acquired_ds__extract_dow',
+ -- 'acquired_ds__extract_doy',
+ -- 'customer_id__acquired_ds__day',
+ -- 'customer_id__acquired_ds__week',
+ -- 'customer_id__acquired_ds__month',
+ -- 'customer_id__acquired_ds__quarter',
+ -- 'customer_id__acquired_ds__year',
+ -- 'customer_id__acquired_ds__extract_year',
+ -- 'customer_id__acquired_ds__extract_quarter',
+ -- 'customer_id__acquired_ds__extract_month',
+ -- 'customer_id__acquired_ds__extract_day',
+ -- 'customer_id__acquired_ds__extract_dow',
+ -- 'customer_id__acquired_ds__extract_doy',
+ -- 'customer_third_hop_id__acquired_ds__day',
+ -- 'customer_third_hop_id__acquired_ds__week',
+ -- 'customer_third_hop_id__acquired_ds__month',
+ -- 'customer_third_hop_id__acquired_ds__quarter',
+ -- 'customer_third_hop_id__acquired_ds__year',
+ -- 'customer_third_hop_id__acquired_ds__extract_year',
+ -- 'customer_third_hop_id__acquired_ds__extract_quarter',
+ -- 'customer_third_hop_id__acquired_ds__extract_month',
+ -- 'customer_third_hop_id__acquired_ds__extract_day',
+ -- 'customer_third_hop_id__acquired_ds__extract_dow',
+ -- 'customer_third_hop_id__acquired_ds__extract_doy',
+ -- 'metric_time__day',
+ -- 'metric_time__week',
+ -- 'metric_time__month',
+ -- 'metric_time__quarter',
+ -- 'metric_time__year',
+ -- 'metric_time__extract_year',
+ -- 'metric_time__extract_quarter',
+ -- 'metric_time__extract_month',
+ -- 'metric_time__extract_day',
+ -- 'metric_time__extract_dow',
+ -- 'metric_time__extract_doy',
+ -- 'customer_id',
+ -- 'customer_third_hop_id',
+ -- 'customer_id__customer_third_hop_id',
+ -- 'customer_third_hop_id__customer_id',
+ -- ]
+ SELECT
+ subq_27.acquired_ds__day
+ , subq_27.acquired_ds__week
+ , subq_27.acquired_ds__month
+ , subq_27.acquired_ds__quarter
+ , subq_27.acquired_ds__year
+ , subq_27.acquired_ds__extract_year
+ , subq_27.acquired_ds__extract_quarter
+ , subq_27.acquired_ds__extract_month
+ , subq_27.acquired_ds__extract_day
+ , subq_27.acquired_ds__extract_dow
+ , subq_27.acquired_ds__extract_doy
+ , subq_27.customer_id__acquired_ds__day
+ , subq_27.customer_id__acquired_ds__week
+ , subq_27.customer_id__acquired_ds__month
+ , subq_27.customer_id__acquired_ds__quarter
+ , subq_27.customer_id__acquired_ds__year
+ , subq_27.customer_id__acquired_ds__extract_year
+ , subq_27.customer_id__acquired_ds__extract_quarter
+ , subq_27.customer_id__acquired_ds__extract_month
+ , subq_27.customer_id__acquired_ds__extract_day
+ , subq_27.customer_id__acquired_ds__extract_dow
+ , subq_27.customer_id__acquired_ds__extract_doy
+ , subq_27.customer_third_hop_id__acquired_ds__day
+ , subq_27.customer_third_hop_id__acquired_ds__week
+ , subq_27.customer_third_hop_id__acquired_ds__month
+ , subq_27.customer_third_hop_id__acquired_ds__quarter
+ , subq_27.customer_third_hop_id__acquired_ds__year
+ , subq_27.customer_third_hop_id__acquired_ds__extract_year
+ , subq_27.customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_27.customer_third_hop_id__acquired_ds__extract_month
+ , subq_27.customer_third_hop_id__acquired_ds__extract_day
+ , subq_27.customer_third_hop_id__acquired_ds__extract_dow
+ , subq_27.customer_third_hop_id__acquired_ds__extract_doy
+ , subq_27.metric_time__day
+ , subq_27.metric_time__week
+ , subq_27.metric_time__month
+ , subq_27.metric_time__quarter
+ , subq_27.metric_time__year
+ , subq_27.metric_time__extract_year
+ , subq_27.metric_time__extract_quarter
+ , subq_27.metric_time__extract_month
+ , subq_27.metric_time__extract_day
+ , subq_27.metric_time__extract_dow
+ , subq_27.metric_time__extract_doy
+ , subq_27.customer_id
+ , subq_27.customer_third_hop_id
+ , subq_27.customer_id__customer_third_hop_id
+ , subq_27.customer_third_hop_id__customer_id
+ , subq_27.country
+ , subq_27.customer_id__country
+ , subq_27.customer_third_hop_id__country
+ FROM (
+ -- Metric Time Dimension 'acquired_ds'
+ SELECT
+ subq_26.acquired_ds__day
+ , subq_26.acquired_ds__week
+ , subq_26.acquired_ds__month
+ , subq_26.acquired_ds__quarter
+ , subq_26.acquired_ds__year
+ , subq_26.acquired_ds__extract_year
+ , subq_26.acquired_ds__extract_quarter
+ , subq_26.acquired_ds__extract_month
+ , subq_26.acquired_ds__extract_day
+ , subq_26.acquired_ds__extract_dow
+ , subq_26.acquired_ds__extract_doy
+ , subq_26.customer_id__acquired_ds__day
+ , subq_26.customer_id__acquired_ds__week
+ , subq_26.customer_id__acquired_ds__month
+ , subq_26.customer_id__acquired_ds__quarter
+ , subq_26.customer_id__acquired_ds__year
+ , subq_26.customer_id__acquired_ds__extract_year
+ , subq_26.customer_id__acquired_ds__extract_quarter
+ , subq_26.customer_id__acquired_ds__extract_month
+ , subq_26.customer_id__acquired_ds__extract_day
+ , subq_26.customer_id__acquired_ds__extract_dow
+ , subq_26.customer_id__acquired_ds__extract_doy
+ , subq_26.customer_third_hop_id__acquired_ds__day
+ , subq_26.customer_third_hop_id__acquired_ds__week
+ , subq_26.customer_third_hop_id__acquired_ds__month
+ , subq_26.customer_third_hop_id__acquired_ds__quarter
+ , subq_26.customer_third_hop_id__acquired_ds__year
+ , subq_26.customer_third_hop_id__acquired_ds__extract_year
+ , subq_26.customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_26.customer_third_hop_id__acquired_ds__extract_month
+ , subq_26.customer_third_hop_id__acquired_ds__extract_day
+ , subq_26.customer_third_hop_id__acquired_ds__extract_dow
+ , subq_26.customer_third_hop_id__acquired_ds__extract_doy
+ , subq_26.acquired_ds__day AS metric_time__day
+ , subq_26.acquired_ds__week AS metric_time__week
+ , subq_26.acquired_ds__month AS metric_time__month
+ , subq_26.acquired_ds__quarter AS metric_time__quarter
+ , subq_26.acquired_ds__year AS metric_time__year
+ , subq_26.acquired_ds__extract_year AS metric_time__extract_year
+ , subq_26.acquired_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_26.acquired_ds__extract_month AS metric_time__extract_month
+ , subq_26.acquired_ds__extract_day AS metric_time__extract_day
+ , subq_26.acquired_ds__extract_dow AS metric_time__extract_dow
+ , subq_26.acquired_ds__extract_doy AS metric_time__extract_doy
+ , subq_26.customer_id
+ , subq_26.customer_third_hop_id
+ , subq_26.customer_id__customer_third_hop_id
+ , subq_26.customer_third_hop_id__customer_id
+ , subq_26.country
+ , subq_26.customer_id__country
+ , subq_26.customer_third_hop_id__country
+ , subq_26.customers_with_other_data
+ FROM (
+ -- Read Elements From Semantic Model 'customer_other_data'
+ SELECT
+ 1 AS customers_with_other_data
+ , customer_other_data_src_22000.country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_day
+ , EXTRACT(isodow FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_day
+ , EXTRACT(isodow FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_third_hop_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_day
+ , EXTRACT(isodow FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.customer_id
+ , customer_other_data_src_22000.customer_third_hop_id
+ , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id
+ , customer_other_data_src_22000.customer_id AS customer_third_hop_id__customer_id
+ FROM ***************************.customer_other_data customer_other_data_src_22000
+ ) subq_26
+ ) subq_27
+ ) subq_28
+ ON
+ subq_25.customer_id = subq_28.customer_id
+ ) subq_29
+ ) subq_30
+ ON
+ (
+ subq_23.account_id = subq_30.account_id
+ ) AND (
+ subq_23.ds_partitioned__day = subq_30.ds_partitioned__day
+ )
+ ) subq_31
+ ) subq_32
+ GROUP BY
+ subq_32.account_id__customer_id__customer_third_hop_id
+ ) subq_33
+ ) subq_34
+ ) subq_35
+ ON
+ subq_20.customer_third_hop_id = subq_35.account_id__customer_id__customer_third_hop_id
+ ) subq_36
+ ) subq_37
+ WHERE customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count > 2
+ ) subq_38
+ ) subq_39
+) subq_40
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_inner_query_multi_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_inner_query_multi_hop__plan0_optimized.sql
new file mode 100644
index 0000000000..d195b8867f
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_inner_query_multi_hop__plan0_optimized.sql
@@ -0,0 +1,49 @@
+-- Constrain Output with WHERE
+-- Pass Only Elements: ['third_hop_count',]
+-- Aggregate Measures
+-- Compute Metrics via Expressions
+SELECT
+ COUNT(DISTINCT third_hop_count) AS third_hop_count
+FROM (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_58.account_id__customer_id__customer_third_hop_id__txn_count AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ LEFT OUTER JOIN (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['txn_count', 'account_id__customer_id__customer_third_hop_id']
+ -- Aggregate Measures
+ -- Compute Metrics via Expressions
+ -- Pass Only Elements: ['account_id__customer_id__customer_third_hop_id', 'account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_53.customer_id__customer_third_hop_id AS account_id__customer_id__customer_third_hop_id
+ , SUM(account_month_txns_src_22000.txn_count) AS account_id__customer_id__customer_third_hop_id__txn_count
+ FROM ***************************.account_month_txns account_month_txns_src_22000
+ LEFT OUTER JOIN (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['ds_partitioned__day', 'account_id', 'customer_id__customer_third_hop_id']
+ SELECT
+ DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , bridge_table_src_22000.account_id AS account_id
+ , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id
+ FROM ***************************.bridge_table bridge_table_src_22000
+ LEFT OUTER JOIN
+ ***************************.customer_other_data customer_other_data_src_22000
+ ON
+ bridge_table_src_22000.customer_id = customer_other_data_src_22000.customer_id
+ ) subq_53
+ ON
+ (
+ account_month_txns_src_22000.account_id = subq_53.account_id
+ ) AND (
+ DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_53.ds_partitioned__day
+ )
+ GROUP BY
+ subq_53.customer_id__customer_third_hop_id
+ ) subq_58
+ ON
+ third_hop_table_src_22000.customer_third_hop_id = subq_58.account_id__customer_id__customer_third_hop_id
+) subq_60
+WHERE customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count > 2
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_inner_query_single_hop__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_inner_query_single_hop__plan0.sql
new file mode 100644
index 0000000000..6a27e35c22
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_inner_query_single_hop__plan0.sql
@@ -0,0 +1,257 @@
+-- Compute Metrics via Expressions
+SELECT
+ subq_21.third_hop_count
+FROM (
+ -- Aggregate Measures
+ SELECT
+ COUNT(DISTINCT subq_20.third_hop_count) AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count',]
+ SELECT
+ subq_19.third_hop_count
+ FROM (
+ -- Constrain Output with WHERE
+ SELECT
+ subq_18.customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , subq_18.third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ subq_17.customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , subq_17.third_hop_count
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_8.customer_third_hop_id AS customer_third_hop_id
+ , subq_16.customer_id__customer_third_hop_id AS customer_third_hop_id__customer_id__customer_third_hop_id
+ , subq_16.customer_id__customer_third_hop_id__paraguayan_customers AS customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , subq_8.third_hop_count AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id']
+ SELECT
+ subq_7.customer_third_hop_id
+ , subq_7.third_hop_count
+ FROM (
+ -- Metric Time Dimension 'third_hop_ds'
+ SELECT
+ subq_6.third_hop_ds__day
+ , subq_6.third_hop_ds__week
+ , subq_6.third_hop_ds__month
+ , subq_6.third_hop_ds__quarter
+ , subq_6.third_hop_ds__year
+ , subq_6.third_hop_ds__extract_year
+ , subq_6.third_hop_ds__extract_quarter
+ , subq_6.third_hop_ds__extract_month
+ , subq_6.third_hop_ds__extract_day
+ , subq_6.third_hop_ds__extract_dow
+ , subq_6.third_hop_ds__extract_doy
+ , subq_6.customer_third_hop_id__third_hop_ds__day
+ , subq_6.customer_third_hop_id__third_hop_ds__week
+ , subq_6.customer_third_hop_id__third_hop_ds__month
+ , subq_6.customer_third_hop_id__third_hop_ds__quarter
+ , subq_6.customer_third_hop_id__third_hop_ds__year
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_year
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_quarter
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_month
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_day
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_dow
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_doy
+ , subq_6.third_hop_ds__day AS metric_time__day
+ , subq_6.third_hop_ds__week AS metric_time__week
+ , subq_6.third_hop_ds__month AS metric_time__month
+ , subq_6.third_hop_ds__quarter AS metric_time__quarter
+ , subq_6.third_hop_ds__year AS metric_time__year
+ , subq_6.third_hop_ds__extract_year AS metric_time__extract_year
+ , subq_6.third_hop_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_6.third_hop_ds__extract_month AS metric_time__extract_month
+ , subq_6.third_hop_ds__extract_day AS metric_time__extract_day
+ , subq_6.third_hop_ds__extract_dow AS metric_time__extract_dow
+ , subq_6.third_hop_ds__extract_doy AS metric_time__extract_doy
+ , subq_6.customer_third_hop_id
+ , subq_6.value
+ , subq_6.customer_third_hop_id__value
+ , subq_6.third_hop_count
+ FROM (
+ -- Read Elements From Semantic Model 'third_hop_table'
+ SELECT
+ third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ , third_hop_table_src_22000.value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_day
+ , EXTRACT(isodow FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_doy
+ , third_hop_table_src_22000.value AS customer_third_hop_id__value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_day
+ , EXTRACT(isodow FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_doy
+ , third_hop_table_src_22000.customer_third_hop_id
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ ) subq_6
+ ) subq_7
+ ) subq_8
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: ['customer_id__customer_third_hop_id', 'customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ subq_15.customer_id__customer_third_hop_id
+ , subq_15.customer_id__customer_third_hop_id__paraguayan_customers
+ FROM (
+ -- Compute Metrics via Expressions
+ SELECT
+ subq_14.customer_id__customer_third_hop_id
+ , subq_14.customers_with_other_data AS customer_id__customer_third_hop_id__paraguayan_customers
+ FROM (
+ -- Aggregate Measures
+ SELECT
+ subq_13.customer_id__customer_third_hop_id
+ , SUM(subq_13.customers_with_other_data) AS customers_with_other_data
+ FROM (
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__customer_third_hop_id']
+ SELECT
+ subq_12.customer_id__customer_third_hop_id
+ , subq_12.customers_with_other_data
+ FROM (
+ -- Constrain Output with WHERE
+ SELECT
+ subq_11.customer_id__customer_third_hop_id
+ , subq_11.customer_id__country
+ , subq_11.customers_with_other_data
+ FROM (
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id']
+ SELECT
+ subq_10.customer_id__customer_third_hop_id
+ , subq_10.customer_id__country
+ , subq_10.customers_with_other_data
+ FROM (
+ -- Metric Time Dimension 'acquired_ds'
+ SELECT
+ subq_9.acquired_ds__day
+ , subq_9.acquired_ds__week
+ , subq_9.acquired_ds__month
+ , subq_9.acquired_ds__quarter
+ , subq_9.acquired_ds__year
+ , subq_9.acquired_ds__extract_year
+ , subq_9.acquired_ds__extract_quarter
+ , subq_9.acquired_ds__extract_month
+ , subq_9.acquired_ds__extract_day
+ , subq_9.acquired_ds__extract_dow
+ , subq_9.acquired_ds__extract_doy
+ , subq_9.customer_id__acquired_ds__day
+ , subq_9.customer_id__acquired_ds__week
+ , subq_9.customer_id__acquired_ds__month
+ , subq_9.customer_id__acquired_ds__quarter
+ , subq_9.customer_id__acquired_ds__year
+ , subq_9.customer_id__acquired_ds__extract_year
+ , subq_9.customer_id__acquired_ds__extract_quarter
+ , subq_9.customer_id__acquired_ds__extract_month
+ , subq_9.customer_id__acquired_ds__extract_day
+ , subq_9.customer_id__acquired_ds__extract_dow
+ , subq_9.customer_id__acquired_ds__extract_doy
+ , subq_9.customer_third_hop_id__acquired_ds__day
+ , subq_9.customer_third_hop_id__acquired_ds__week
+ , subq_9.customer_third_hop_id__acquired_ds__month
+ , subq_9.customer_third_hop_id__acquired_ds__quarter
+ , subq_9.customer_third_hop_id__acquired_ds__year
+ , subq_9.customer_third_hop_id__acquired_ds__extract_year
+ , subq_9.customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_9.customer_third_hop_id__acquired_ds__extract_month
+ , subq_9.customer_third_hop_id__acquired_ds__extract_day
+ , subq_9.customer_third_hop_id__acquired_ds__extract_dow
+ , subq_9.customer_third_hop_id__acquired_ds__extract_doy
+ , subq_9.acquired_ds__day AS metric_time__day
+ , subq_9.acquired_ds__week AS metric_time__week
+ , subq_9.acquired_ds__month AS metric_time__month
+ , subq_9.acquired_ds__quarter AS metric_time__quarter
+ , subq_9.acquired_ds__year AS metric_time__year
+ , subq_9.acquired_ds__extract_year AS metric_time__extract_year
+ , subq_9.acquired_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.acquired_ds__extract_month AS metric_time__extract_month
+ , subq_9.acquired_ds__extract_day AS metric_time__extract_day
+ , subq_9.acquired_ds__extract_dow AS metric_time__extract_dow
+ , subq_9.acquired_ds__extract_doy AS metric_time__extract_doy
+ , subq_9.customer_id
+ , subq_9.customer_third_hop_id
+ , subq_9.customer_id__customer_third_hop_id
+ , subq_9.customer_third_hop_id__customer_id
+ , subq_9.country
+ , subq_9.customer_id__country
+ , subq_9.customer_third_hop_id__country
+ , subq_9.customers_with_other_data
+ FROM (
+ -- Read Elements From Semantic Model 'customer_other_data'
+ SELECT
+ 1 AS customers_with_other_data
+ , customer_other_data_src_22000.country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_day
+ , EXTRACT(isodow FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_day
+ , EXTRACT(isodow FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_third_hop_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_day
+ , EXTRACT(isodow FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.customer_id
+ , customer_other_data_src_22000.customer_third_hop_id
+ , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id
+ , customer_other_data_src_22000.customer_id AS customer_third_hop_id__customer_id
+ FROM ***************************.customer_other_data customer_other_data_src_22000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+ WHERE customer_id__country = 'paraguay'
+ ) subq_12
+ ) subq_13
+ GROUP BY
+ subq_13.customer_id__customer_third_hop_id
+ ) subq_14
+ ) subq_15
+ ) subq_16
+ ON
+ subq_8.customer_third_hop_id = subq_16.customer_id__customer_third_hop_id
+ ) subq_17
+ ) subq_18
+ WHERE customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers > 0
+ ) subq_19
+ ) subq_20
+) subq_21
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_inner_query_single_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_inner_query_single_hop__plan0_optimized.sql
new file mode 100644
index 0000000000..2ad52ec04c
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_inner_query_single_hop__plan0_optimized.sql
@@ -0,0 +1,40 @@
+-- Constrain Output with WHERE
+-- Pass Only Elements: ['third_hop_count',]
+-- Aggregate Measures
+-- Compute Metrics via Expressions
+SELECT
+ COUNT(DISTINCT third_hop_count) AS third_hop_count
+FROM (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ subq_32.customer_id__customer_third_hop_id__paraguayan_customers AS customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ LEFT OUTER JOIN (
+ -- Constrain Output with WHERE
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__customer_third_hop_id']
+ -- Aggregate Measures
+ -- Compute Metrics via Expressions
+ -- Pass Only Elements: ['customer_id__customer_third_hop_id', 'customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ customer_id__customer_third_hop_id
+ , SUM(customers_with_other_data) AS customer_id__customer_third_hop_id__paraguayan_customers
+ FROM (
+ -- Read Elements From Semantic Model 'customer_other_data'
+ -- Metric Time Dimension 'acquired_ds'
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id']
+ SELECT
+ customer_third_hop_id AS customer_id__customer_third_hop_id
+ , country AS customer_id__country
+ , 1 AS customers_with_other_data
+ FROM ***************************.customer_other_data customer_other_data_src_22000
+ ) subq_27
+ WHERE customer_id__country = 'paraguay'
+ GROUP BY
+ customer_id__customer_third_hop_id
+ ) subq_32
+ ON
+ third_hop_table_src_22000.customer_third_hop_id = subq_32.customer_id__customer_third_hop_id
+) subq_34
+WHERE customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers > 0
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Postgres/test_inner_query_multi_hop__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Postgres/test_inner_query_multi_hop__plan0.sql
new file mode 100644
index 0000000000..7deea353a9
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Postgres/test_inner_query_multi_hop__plan0.sql
@@ -0,0 +1,694 @@
+-- Compute Metrics via Expressions
+SELECT
+ subq_40.third_hop_count
+FROM (
+ -- Aggregate Measures
+ SELECT
+ COUNT(DISTINCT subq_39.third_hop_count) AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count',]
+ SELECT
+ subq_38.third_hop_count
+ FROM (
+ -- Constrain Output with WHERE
+ SELECT
+ subq_37.customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , subq_37.third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_36.customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , subq_36.third_hop_count
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_20.customer_third_hop_id AS customer_third_hop_id
+ , subq_35.account_id__customer_id__customer_third_hop_id AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id
+ , subq_35.account_id__customer_id__customer_third_hop_id__txn_count AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , subq_20.third_hop_count AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id']
+ SELECT
+ subq_19.customer_third_hop_id
+ , subq_19.third_hop_count
+ FROM (
+ -- Metric Time Dimension 'third_hop_ds'
+ SELECT
+ subq_18.third_hop_ds__day
+ , subq_18.third_hop_ds__week
+ , subq_18.third_hop_ds__month
+ , subq_18.third_hop_ds__quarter
+ , subq_18.third_hop_ds__year
+ , subq_18.third_hop_ds__extract_year
+ , subq_18.third_hop_ds__extract_quarter
+ , subq_18.third_hop_ds__extract_month
+ , subq_18.third_hop_ds__extract_day
+ , subq_18.third_hop_ds__extract_dow
+ , subq_18.third_hop_ds__extract_doy
+ , subq_18.customer_third_hop_id__third_hop_ds__day
+ , subq_18.customer_third_hop_id__third_hop_ds__week
+ , subq_18.customer_third_hop_id__third_hop_ds__month
+ , subq_18.customer_third_hop_id__third_hop_ds__quarter
+ , subq_18.customer_third_hop_id__third_hop_ds__year
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_year
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_quarter
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_month
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_day
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_dow
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_doy
+ , subq_18.third_hop_ds__day AS metric_time__day
+ , subq_18.third_hop_ds__week AS metric_time__week
+ , subq_18.third_hop_ds__month AS metric_time__month
+ , subq_18.third_hop_ds__quarter AS metric_time__quarter
+ , subq_18.third_hop_ds__year AS metric_time__year
+ , subq_18.third_hop_ds__extract_year AS metric_time__extract_year
+ , subq_18.third_hop_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_18.third_hop_ds__extract_month AS metric_time__extract_month
+ , subq_18.third_hop_ds__extract_day AS metric_time__extract_day
+ , subq_18.third_hop_ds__extract_dow AS metric_time__extract_dow
+ , subq_18.third_hop_ds__extract_doy AS metric_time__extract_doy
+ , subq_18.customer_third_hop_id
+ , subq_18.value
+ , subq_18.customer_third_hop_id__value
+ , subq_18.third_hop_count
+ FROM (
+ -- Read Elements From Semantic Model 'third_hop_table'
+ SELECT
+ third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ , third_hop_table_src_22000.value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_day
+ , EXTRACT(isodow FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_doy
+ , third_hop_table_src_22000.value AS customer_third_hop_id__value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_day
+ , EXTRACT(isodow FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_doy
+ , third_hop_table_src_22000.customer_third_hop_id
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ ) subq_18
+ ) subq_19
+ ) subq_20
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: ['account_id__customer_id__customer_third_hop_id', 'account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_34.account_id__customer_id__customer_third_hop_id
+ , subq_34.account_id__customer_id__customer_third_hop_id__txn_count
+ FROM (
+ -- Compute Metrics via Expressions
+ SELECT
+ subq_33.account_id__customer_id__customer_third_hop_id
+ , subq_33.txn_count AS account_id__customer_id__customer_third_hop_id__txn_count
+ FROM (
+ -- Aggregate Measures
+ SELECT
+ subq_32.account_id__customer_id__customer_third_hop_id
+ , SUM(subq_32.txn_count) AS txn_count
+ FROM (
+ -- Pass Only Elements: ['txn_count', 'account_id__customer_id__customer_third_hop_id']
+ SELECT
+ subq_31.account_id__customer_id__customer_third_hop_id
+ , subq_31.txn_count
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_23.ds_partitioned__day AS ds_partitioned__day
+ , subq_30.ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_23.account_id AS account_id
+ , subq_30.customer_id__customer_third_hop_id AS account_id__customer_id__customer_third_hop_id
+ , subq_23.txn_count AS txn_count
+ FROM (
+ -- Pass Only Elements: ['txn_count', 'ds_partitioned__day', 'account_id']
+ SELECT
+ subq_22.ds_partitioned__day
+ , subq_22.account_id
+ , subq_22.txn_count
+ FROM (
+ -- Metric Time Dimension 'ds'
+ SELECT
+ subq_21.ds_partitioned__day
+ , subq_21.ds_partitioned__week
+ , subq_21.ds_partitioned__month
+ , subq_21.ds_partitioned__quarter
+ , subq_21.ds_partitioned__year
+ , subq_21.ds_partitioned__extract_year
+ , subq_21.ds_partitioned__extract_quarter
+ , subq_21.ds_partitioned__extract_month
+ , subq_21.ds_partitioned__extract_day
+ , subq_21.ds_partitioned__extract_dow
+ , subq_21.ds_partitioned__extract_doy
+ , subq_21.ds__day
+ , subq_21.ds__week
+ , subq_21.ds__month
+ , subq_21.ds__quarter
+ , subq_21.ds__year
+ , subq_21.ds__extract_year
+ , subq_21.ds__extract_quarter
+ , subq_21.ds__extract_month
+ , subq_21.ds__extract_day
+ , subq_21.ds__extract_dow
+ , subq_21.ds__extract_doy
+ , subq_21.account_id__ds_partitioned__day
+ , subq_21.account_id__ds_partitioned__week
+ , subq_21.account_id__ds_partitioned__month
+ , subq_21.account_id__ds_partitioned__quarter
+ , subq_21.account_id__ds_partitioned__year
+ , subq_21.account_id__ds_partitioned__extract_year
+ , subq_21.account_id__ds_partitioned__extract_quarter
+ , subq_21.account_id__ds_partitioned__extract_month
+ , subq_21.account_id__ds_partitioned__extract_day
+ , subq_21.account_id__ds_partitioned__extract_dow
+ , subq_21.account_id__ds_partitioned__extract_doy
+ , subq_21.account_id__ds__day
+ , subq_21.account_id__ds__week
+ , subq_21.account_id__ds__month
+ , subq_21.account_id__ds__quarter
+ , subq_21.account_id__ds__year
+ , subq_21.account_id__ds__extract_year
+ , subq_21.account_id__ds__extract_quarter
+ , subq_21.account_id__ds__extract_month
+ , subq_21.account_id__ds__extract_day
+ , subq_21.account_id__ds__extract_dow
+ , subq_21.account_id__ds__extract_doy
+ , subq_21.ds__day AS metric_time__day
+ , subq_21.ds__week AS metric_time__week
+ , subq_21.ds__month AS metric_time__month
+ , subq_21.ds__quarter AS metric_time__quarter
+ , subq_21.ds__year AS metric_time__year
+ , subq_21.ds__extract_year AS metric_time__extract_year
+ , subq_21.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_21.ds__extract_month AS metric_time__extract_month
+ , subq_21.ds__extract_day AS metric_time__extract_day
+ , subq_21.ds__extract_dow AS metric_time__extract_dow
+ , subq_21.ds__extract_doy AS metric_time__extract_doy
+ , subq_21.account_id
+ , subq_21.account_month
+ , subq_21.account_id__account_month
+ , subq_21.txn_count
+ FROM (
+ -- Read Elements From Semantic Model 'account_month_txns'
+ SELECT
+ account_month_txns_src_22000.txn_count
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(isodow FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS ds__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS ds__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS ds__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS ds__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS ds__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds) AS ds__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS ds__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds) AS ds__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM account_month_txns_src_22000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS ds__extract_doy
+ , account_month_txns_src_22000.account_month
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
+ , EXTRACT(isodow FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS account_id__ds__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS account_id__ds__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS account_id__ds__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS account_id__ds__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS account_id__ds__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_day
+ , EXTRACT(isodow FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_doy
+ , account_month_txns_src_22000.account_month AS account_id__account_month
+ , account_month_txns_src_22000.account_id
+ FROM ***************************.account_month_txns account_month_txns_src_22000
+ ) subq_21
+ ) subq_22
+ ) subq_23
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: ['ds_partitioned__day', 'account_id', 'customer_id__customer_third_hop_id']
+ SELECT
+ subq_29.ds_partitioned__day
+ , subq_29.account_id
+ , subq_29.customer_id__customer_third_hop_id
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_25.ds_partitioned__day AS ds_partitioned__day
+ , subq_25.ds_partitioned__week AS ds_partitioned__week
+ , subq_25.ds_partitioned__month AS ds_partitioned__month
+ , subq_25.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_25.ds_partitioned__year AS ds_partitioned__year
+ , subq_25.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_25.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_25.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_25.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_25.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_25.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_25.account_id__ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_25.account_id__ds_partitioned__week AS account_id__ds_partitioned__week
+ , subq_25.account_id__ds_partitioned__month AS account_id__ds_partitioned__month
+ , subq_25.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter
+ , subq_25.account_id__ds_partitioned__year AS account_id__ds_partitioned__year
+ , subq_25.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year
+ , subq_25.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter
+ , subq_25.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month
+ , subq_25.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day
+ , subq_25.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow
+ , subq_25.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy
+ , subq_25.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day
+ , subq_25.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week
+ , subq_25.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month
+ , subq_25.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter
+ , subq_25.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year
+ , subq_25.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year
+ , subq_25.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter
+ , subq_25.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month
+ , subq_25.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day
+ , subq_25.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow
+ , subq_25.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy
+ , subq_25.metric_time__day AS metric_time__day
+ , subq_25.metric_time__week AS metric_time__week
+ , subq_25.metric_time__month AS metric_time__month
+ , subq_25.metric_time__quarter AS metric_time__quarter
+ , subq_25.metric_time__year AS metric_time__year
+ , subq_25.metric_time__extract_year AS metric_time__extract_year
+ , subq_25.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_25.metric_time__extract_month AS metric_time__extract_month
+ , subq_25.metric_time__extract_day AS metric_time__extract_day
+ , subq_25.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_25.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_28.acquired_ds__day AS customer_id__acquired_ds__day
+ , subq_28.acquired_ds__week AS customer_id__acquired_ds__week
+ , subq_28.acquired_ds__month AS customer_id__acquired_ds__month
+ , subq_28.acquired_ds__quarter AS customer_id__acquired_ds__quarter
+ , subq_28.acquired_ds__year AS customer_id__acquired_ds__year
+ , subq_28.acquired_ds__extract_year AS customer_id__acquired_ds__extract_year
+ , subq_28.acquired_ds__extract_quarter AS customer_id__acquired_ds__extract_quarter
+ , subq_28.acquired_ds__extract_month AS customer_id__acquired_ds__extract_month
+ , subq_28.acquired_ds__extract_day AS customer_id__acquired_ds__extract_day
+ , subq_28.acquired_ds__extract_dow AS customer_id__acquired_ds__extract_dow
+ , subq_28.acquired_ds__extract_doy AS customer_id__acquired_ds__extract_doy
+ , subq_28.customer_third_hop_id__acquired_ds__day AS customer_id__customer_third_hop_id__acquired_ds__day
+ , subq_28.customer_third_hop_id__acquired_ds__week AS customer_id__customer_third_hop_id__acquired_ds__week
+ , subq_28.customer_third_hop_id__acquired_ds__month AS customer_id__customer_third_hop_id__acquired_ds__month
+ , subq_28.customer_third_hop_id__acquired_ds__quarter AS customer_id__customer_third_hop_id__acquired_ds__quarter
+ , subq_28.customer_third_hop_id__acquired_ds__year AS customer_id__customer_third_hop_id__acquired_ds__year
+ , subq_28.customer_third_hop_id__acquired_ds__extract_year AS customer_id__customer_third_hop_id__acquired_ds__extract_year
+ , subq_28.customer_third_hop_id__acquired_ds__extract_quarter AS customer_id__customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_28.customer_third_hop_id__acquired_ds__extract_month AS customer_id__customer_third_hop_id__acquired_ds__extract_month
+ , subq_28.customer_third_hop_id__acquired_ds__extract_day AS customer_id__customer_third_hop_id__acquired_ds__extract_day
+ , subq_28.customer_third_hop_id__acquired_ds__extract_dow AS customer_id__customer_third_hop_id__acquired_ds__extract_dow
+ , subq_28.customer_third_hop_id__acquired_ds__extract_doy AS customer_id__customer_third_hop_id__acquired_ds__extract_doy
+ , subq_28.metric_time__day AS customer_id__metric_time__day
+ , subq_28.metric_time__week AS customer_id__metric_time__week
+ , subq_28.metric_time__month AS customer_id__metric_time__month
+ , subq_28.metric_time__quarter AS customer_id__metric_time__quarter
+ , subq_28.metric_time__year AS customer_id__metric_time__year
+ , subq_28.metric_time__extract_year AS customer_id__metric_time__extract_year
+ , subq_28.metric_time__extract_quarter AS customer_id__metric_time__extract_quarter
+ , subq_28.metric_time__extract_month AS customer_id__metric_time__extract_month
+ , subq_28.metric_time__extract_day AS customer_id__metric_time__extract_day
+ , subq_28.metric_time__extract_dow AS customer_id__metric_time__extract_dow
+ , subq_28.metric_time__extract_doy AS customer_id__metric_time__extract_doy
+ , subq_25.account_id AS account_id
+ , subq_25.customer_id AS customer_id
+ , subq_25.account_id__customer_id AS account_id__customer_id
+ , subq_25.bridge_account__account_id AS bridge_account__account_id
+ , subq_25.bridge_account__customer_id AS bridge_account__customer_id
+ , subq_28.customer_third_hop_id AS customer_id__customer_third_hop_id
+ , subq_28.customer_third_hop_id__customer_id AS customer_id__customer_third_hop_id__customer_id
+ , subq_25.extra_dim AS extra_dim
+ , subq_25.account_id__extra_dim AS account_id__extra_dim
+ , subq_25.bridge_account__extra_dim AS bridge_account__extra_dim
+ , subq_28.country AS customer_id__country
+ , subq_28.customer_third_hop_id__country AS customer_id__customer_third_hop_id__country
+ , subq_25.account_customer_combos AS account_customer_combos
+ FROM (
+ -- Metric Time Dimension 'ds_partitioned'
+ SELECT
+ subq_24.ds_partitioned__day
+ , subq_24.ds_partitioned__week
+ , subq_24.ds_partitioned__month
+ , subq_24.ds_partitioned__quarter
+ , subq_24.ds_partitioned__year
+ , subq_24.ds_partitioned__extract_year
+ , subq_24.ds_partitioned__extract_quarter
+ , subq_24.ds_partitioned__extract_month
+ , subq_24.ds_partitioned__extract_day
+ , subq_24.ds_partitioned__extract_dow
+ , subq_24.ds_partitioned__extract_doy
+ , subq_24.account_id__ds_partitioned__day
+ , subq_24.account_id__ds_partitioned__week
+ , subq_24.account_id__ds_partitioned__month
+ , subq_24.account_id__ds_partitioned__quarter
+ , subq_24.account_id__ds_partitioned__year
+ , subq_24.account_id__ds_partitioned__extract_year
+ , subq_24.account_id__ds_partitioned__extract_quarter
+ , subq_24.account_id__ds_partitioned__extract_month
+ , subq_24.account_id__ds_partitioned__extract_day
+ , subq_24.account_id__ds_partitioned__extract_dow
+ , subq_24.account_id__ds_partitioned__extract_doy
+ , subq_24.bridge_account__ds_partitioned__day
+ , subq_24.bridge_account__ds_partitioned__week
+ , subq_24.bridge_account__ds_partitioned__month
+ , subq_24.bridge_account__ds_partitioned__quarter
+ , subq_24.bridge_account__ds_partitioned__year
+ , subq_24.bridge_account__ds_partitioned__extract_year
+ , subq_24.bridge_account__ds_partitioned__extract_quarter
+ , subq_24.bridge_account__ds_partitioned__extract_month
+ , subq_24.bridge_account__ds_partitioned__extract_day
+ , subq_24.bridge_account__ds_partitioned__extract_dow
+ , subq_24.bridge_account__ds_partitioned__extract_doy
+ , subq_24.ds_partitioned__day AS metric_time__day
+ , subq_24.ds_partitioned__week AS metric_time__week
+ , subq_24.ds_partitioned__month AS metric_time__month
+ , subq_24.ds_partitioned__quarter AS metric_time__quarter
+ , subq_24.ds_partitioned__year AS metric_time__year
+ , subq_24.ds_partitioned__extract_year AS metric_time__extract_year
+ , subq_24.ds_partitioned__extract_quarter AS metric_time__extract_quarter
+ , subq_24.ds_partitioned__extract_month AS metric_time__extract_month
+ , subq_24.ds_partitioned__extract_day AS metric_time__extract_day
+ , subq_24.ds_partitioned__extract_dow AS metric_time__extract_dow
+ , subq_24.ds_partitioned__extract_doy AS metric_time__extract_doy
+ , subq_24.account_id
+ , subq_24.customer_id
+ , subq_24.account_id__customer_id
+ , subq_24.bridge_account__account_id
+ , subq_24.bridge_account__customer_id
+ , subq_24.extra_dim
+ , subq_24.account_id__extra_dim
+ , subq_24.bridge_account__extra_dim
+ , subq_24.account_customer_combos
+ FROM (
+ -- Read Elements From Semantic Model 'bridge_table'
+ SELECT
+ account_id || customer_id AS account_customer_combos
+ , bridge_table_src_22000.extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(isodow FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS account_id__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
+ , EXTRACT(isodow FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_day
+ , EXTRACT(isodow FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy
+ , bridge_table_src_22000.account_id
+ , bridge_table_src_22000.customer_id
+ , bridge_table_src_22000.customer_id AS account_id__customer_id
+ , bridge_table_src_22000.account_id AS bridge_account__account_id
+ , bridge_table_src_22000.customer_id AS bridge_account__customer_id
+ FROM ***************************.bridge_table bridge_table_src_22000
+ ) subq_24
+ ) subq_25
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: [
+ -- 'country',
+ -- 'customer_id__country',
+ -- 'customer_third_hop_id__country',
+ -- 'acquired_ds__day',
+ -- 'acquired_ds__week',
+ -- 'acquired_ds__month',
+ -- 'acquired_ds__quarter',
+ -- 'acquired_ds__year',
+ -- 'acquired_ds__extract_year',
+ -- 'acquired_ds__extract_quarter',
+ -- 'acquired_ds__extract_month',
+ -- 'acquired_ds__extract_day',
+ -- 'acquired_ds__extract_dow',
+ -- 'acquired_ds__extract_doy',
+ -- 'customer_id__acquired_ds__day',
+ -- 'customer_id__acquired_ds__week',
+ -- 'customer_id__acquired_ds__month',
+ -- 'customer_id__acquired_ds__quarter',
+ -- 'customer_id__acquired_ds__year',
+ -- 'customer_id__acquired_ds__extract_year',
+ -- 'customer_id__acquired_ds__extract_quarter',
+ -- 'customer_id__acquired_ds__extract_month',
+ -- 'customer_id__acquired_ds__extract_day',
+ -- 'customer_id__acquired_ds__extract_dow',
+ -- 'customer_id__acquired_ds__extract_doy',
+ -- 'customer_third_hop_id__acquired_ds__day',
+ -- 'customer_third_hop_id__acquired_ds__week',
+ -- 'customer_third_hop_id__acquired_ds__month',
+ -- 'customer_third_hop_id__acquired_ds__quarter',
+ -- 'customer_third_hop_id__acquired_ds__year',
+ -- 'customer_third_hop_id__acquired_ds__extract_year',
+ -- 'customer_third_hop_id__acquired_ds__extract_quarter',
+ -- 'customer_third_hop_id__acquired_ds__extract_month',
+ -- 'customer_third_hop_id__acquired_ds__extract_day',
+ -- 'customer_third_hop_id__acquired_ds__extract_dow',
+ -- 'customer_third_hop_id__acquired_ds__extract_doy',
+ -- 'metric_time__day',
+ -- 'metric_time__week',
+ -- 'metric_time__month',
+ -- 'metric_time__quarter',
+ -- 'metric_time__year',
+ -- 'metric_time__extract_year',
+ -- 'metric_time__extract_quarter',
+ -- 'metric_time__extract_month',
+ -- 'metric_time__extract_day',
+ -- 'metric_time__extract_dow',
+ -- 'metric_time__extract_doy',
+ -- 'customer_id',
+ -- 'customer_third_hop_id',
+ -- 'customer_id__customer_third_hop_id',
+ -- 'customer_third_hop_id__customer_id',
+ -- ]
+ SELECT
+ subq_27.acquired_ds__day
+ , subq_27.acquired_ds__week
+ , subq_27.acquired_ds__month
+ , subq_27.acquired_ds__quarter
+ , subq_27.acquired_ds__year
+ , subq_27.acquired_ds__extract_year
+ , subq_27.acquired_ds__extract_quarter
+ , subq_27.acquired_ds__extract_month
+ , subq_27.acquired_ds__extract_day
+ , subq_27.acquired_ds__extract_dow
+ , subq_27.acquired_ds__extract_doy
+ , subq_27.customer_id__acquired_ds__day
+ , subq_27.customer_id__acquired_ds__week
+ , subq_27.customer_id__acquired_ds__month
+ , subq_27.customer_id__acquired_ds__quarter
+ , subq_27.customer_id__acquired_ds__year
+ , subq_27.customer_id__acquired_ds__extract_year
+ , subq_27.customer_id__acquired_ds__extract_quarter
+ , subq_27.customer_id__acquired_ds__extract_month
+ , subq_27.customer_id__acquired_ds__extract_day
+ , subq_27.customer_id__acquired_ds__extract_dow
+ , subq_27.customer_id__acquired_ds__extract_doy
+ , subq_27.customer_third_hop_id__acquired_ds__day
+ , subq_27.customer_third_hop_id__acquired_ds__week
+ , subq_27.customer_third_hop_id__acquired_ds__month
+ , subq_27.customer_third_hop_id__acquired_ds__quarter
+ , subq_27.customer_third_hop_id__acquired_ds__year
+ , subq_27.customer_third_hop_id__acquired_ds__extract_year
+ , subq_27.customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_27.customer_third_hop_id__acquired_ds__extract_month
+ , subq_27.customer_third_hop_id__acquired_ds__extract_day
+ , subq_27.customer_third_hop_id__acquired_ds__extract_dow
+ , subq_27.customer_third_hop_id__acquired_ds__extract_doy
+ , subq_27.metric_time__day
+ , subq_27.metric_time__week
+ , subq_27.metric_time__month
+ , subq_27.metric_time__quarter
+ , subq_27.metric_time__year
+ , subq_27.metric_time__extract_year
+ , subq_27.metric_time__extract_quarter
+ , subq_27.metric_time__extract_month
+ , subq_27.metric_time__extract_day
+ , subq_27.metric_time__extract_dow
+ , subq_27.metric_time__extract_doy
+ , subq_27.customer_id
+ , subq_27.customer_third_hop_id
+ , subq_27.customer_id__customer_third_hop_id
+ , subq_27.customer_third_hop_id__customer_id
+ , subq_27.country
+ , subq_27.customer_id__country
+ , subq_27.customer_third_hop_id__country
+ FROM (
+ -- Metric Time Dimension 'acquired_ds'
+ SELECT
+ subq_26.acquired_ds__day
+ , subq_26.acquired_ds__week
+ , subq_26.acquired_ds__month
+ , subq_26.acquired_ds__quarter
+ , subq_26.acquired_ds__year
+ , subq_26.acquired_ds__extract_year
+ , subq_26.acquired_ds__extract_quarter
+ , subq_26.acquired_ds__extract_month
+ , subq_26.acquired_ds__extract_day
+ , subq_26.acquired_ds__extract_dow
+ , subq_26.acquired_ds__extract_doy
+ , subq_26.customer_id__acquired_ds__day
+ , subq_26.customer_id__acquired_ds__week
+ , subq_26.customer_id__acquired_ds__month
+ , subq_26.customer_id__acquired_ds__quarter
+ , subq_26.customer_id__acquired_ds__year
+ , subq_26.customer_id__acquired_ds__extract_year
+ , subq_26.customer_id__acquired_ds__extract_quarter
+ , subq_26.customer_id__acquired_ds__extract_month
+ , subq_26.customer_id__acquired_ds__extract_day
+ , subq_26.customer_id__acquired_ds__extract_dow
+ , subq_26.customer_id__acquired_ds__extract_doy
+ , subq_26.customer_third_hop_id__acquired_ds__day
+ , subq_26.customer_third_hop_id__acquired_ds__week
+ , subq_26.customer_third_hop_id__acquired_ds__month
+ , subq_26.customer_third_hop_id__acquired_ds__quarter
+ , subq_26.customer_third_hop_id__acquired_ds__year
+ , subq_26.customer_third_hop_id__acquired_ds__extract_year
+ , subq_26.customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_26.customer_third_hop_id__acquired_ds__extract_month
+ , subq_26.customer_third_hop_id__acquired_ds__extract_day
+ , subq_26.customer_third_hop_id__acquired_ds__extract_dow
+ , subq_26.customer_third_hop_id__acquired_ds__extract_doy
+ , subq_26.acquired_ds__day AS metric_time__day
+ , subq_26.acquired_ds__week AS metric_time__week
+ , subq_26.acquired_ds__month AS metric_time__month
+ , subq_26.acquired_ds__quarter AS metric_time__quarter
+ , subq_26.acquired_ds__year AS metric_time__year
+ , subq_26.acquired_ds__extract_year AS metric_time__extract_year
+ , subq_26.acquired_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_26.acquired_ds__extract_month AS metric_time__extract_month
+ , subq_26.acquired_ds__extract_day AS metric_time__extract_day
+ , subq_26.acquired_ds__extract_dow AS metric_time__extract_dow
+ , subq_26.acquired_ds__extract_doy AS metric_time__extract_doy
+ , subq_26.customer_id
+ , subq_26.customer_third_hop_id
+ , subq_26.customer_id__customer_third_hop_id
+ , subq_26.customer_third_hop_id__customer_id
+ , subq_26.country
+ , subq_26.customer_id__country
+ , subq_26.customer_third_hop_id__country
+ , subq_26.customers_with_other_data
+ FROM (
+ -- Read Elements From Semantic Model 'customer_other_data'
+ SELECT
+ 1 AS customers_with_other_data
+ , customer_other_data_src_22000.country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_day
+ , EXTRACT(isodow FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_day
+ , EXTRACT(isodow FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_third_hop_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_day
+ , EXTRACT(isodow FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.customer_id
+ , customer_other_data_src_22000.customer_third_hop_id
+ , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id
+ , customer_other_data_src_22000.customer_id AS customer_third_hop_id__customer_id
+ FROM ***************************.customer_other_data customer_other_data_src_22000
+ ) subq_26
+ ) subq_27
+ ) subq_28
+ ON
+ subq_25.customer_id = subq_28.customer_id
+ ) subq_29
+ ) subq_30
+ ON
+ (
+ subq_23.account_id = subq_30.account_id
+ ) AND (
+ subq_23.ds_partitioned__day = subq_30.ds_partitioned__day
+ )
+ ) subq_31
+ ) subq_32
+ GROUP BY
+ subq_32.account_id__customer_id__customer_third_hop_id
+ ) subq_33
+ ) subq_34
+ ) subq_35
+ ON
+ subq_20.customer_third_hop_id = subq_35.account_id__customer_id__customer_third_hop_id
+ ) subq_36
+ ) subq_37
+ WHERE customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count > 2
+ ) subq_38
+ ) subq_39
+) subq_40
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Postgres/test_inner_query_multi_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Postgres/test_inner_query_multi_hop__plan0_optimized.sql
new file mode 100644
index 0000000000..d195b8867f
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Postgres/test_inner_query_multi_hop__plan0_optimized.sql
@@ -0,0 +1,49 @@
+-- Constrain Output with WHERE
+-- Pass Only Elements: ['third_hop_count',]
+-- Aggregate Measures
+-- Compute Metrics via Expressions
+SELECT
+ COUNT(DISTINCT third_hop_count) AS third_hop_count
+FROM (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_58.account_id__customer_id__customer_third_hop_id__txn_count AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ LEFT OUTER JOIN (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['txn_count', 'account_id__customer_id__customer_third_hop_id']
+ -- Aggregate Measures
+ -- Compute Metrics via Expressions
+ -- Pass Only Elements: ['account_id__customer_id__customer_third_hop_id', 'account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_53.customer_id__customer_third_hop_id AS account_id__customer_id__customer_third_hop_id
+ , SUM(account_month_txns_src_22000.txn_count) AS account_id__customer_id__customer_third_hop_id__txn_count
+ FROM ***************************.account_month_txns account_month_txns_src_22000
+ LEFT OUTER JOIN (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['ds_partitioned__day', 'account_id', 'customer_id__customer_third_hop_id']
+ SELECT
+ DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , bridge_table_src_22000.account_id AS account_id
+ , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id
+ FROM ***************************.bridge_table bridge_table_src_22000
+ LEFT OUTER JOIN
+ ***************************.customer_other_data customer_other_data_src_22000
+ ON
+ bridge_table_src_22000.customer_id = customer_other_data_src_22000.customer_id
+ ) subq_53
+ ON
+ (
+ account_month_txns_src_22000.account_id = subq_53.account_id
+ ) AND (
+ DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_53.ds_partitioned__day
+ )
+ GROUP BY
+ subq_53.customer_id__customer_third_hop_id
+ ) subq_58
+ ON
+ third_hop_table_src_22000.customer_third_hop_id = subq_58.account_id__customer_id__customer_third_hop_id
+) subq_60
+WHERE customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count > 2
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Postgres/test_inner_query_single_hop__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Postgres/test_inner_query_single_hop__plan0.sql
new file mode 100644
index 0000000000..6a27e35c22
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Postgres/test_inner_query_single_hop__plan0.sql
@@ -0,0 +1,257 @@
+-- Compute Metrics via Expressions
+SELECT
+ subq_21.third_hop_count
+FROM (
+ -- Aggregate Measures
+ SELECT
+ COUNT(DISTINCT subq_20.third_hop_count) AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count',]
+ SELECT
+ subq_19.third_hop_count
+ FROM (
+ -- Constrain Output with WHERE
+ SELECT
+ subq_18.customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , subq_18.third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ subq_17.customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , subq_17.third_hop_count
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_8.customer_third_hop_id AS customer_third_hop_id
+ , subq_16.customer_id__customer_third_hop_id AS customer_third_hop_id__customer_id__customer_third_hop_id
+ , subq_16.customer_id__customer_third_hop_id__paraguayan_customers AS customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , subq_8.third_hop_count AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id']
+ SELECT
+ subq_7.customer_third_hop_id
+ , subq_7.third_hop_count
+ FROM (
+ -- Metric Time Dimension 'third_hop_ds'
+ SELECT
+ subq_6.third_hop_ds__day
+ , subq_6.third_hop_ds__week
+ , subq_6.third_hop_ds__month
+ , subq_6.third_hop_ds__quarter
+ , subq_6.third_hop_ds__year
+ , subq_6.third_hop_ds__extract_year
+ , subq_6.third_hop_ds__extract_quarter
+ , subq_6.third_hop_ds__extract_month
+ , subq_6.third_hop_ds__extract_day
+ , subq_6.third_hop_ds__extract_dow
+ , subq_6.third_hop_ds__extract_doy
+ , subq_6.customer_third_hop_id__third_hop_ds__day
+ , subq_6.customer_third_hop_id__third_hop_ds__week
+ , subq_6.customer_third_hop_id__third_hop_ds__month
+ , subq_6.customer_third_hop_id__third_hop_ds__quarter
+ , subq_6.customer_third_hop_id__third_hop_ds__year
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_year
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_quarter
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_month
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_day
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_dow
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_doy
+ , subq_6.third_hop_ds__day AS metric_time__day
+ , subq_6.third_hop_ds__week AS metric_time__week
+ , subq_6.third_hop_ds__month AS metric_time__month
+ , subq_6.third_hop_ds__quarter AS metric_time__quarter
+ , subq_6.third_hop_ds__year AS metric_time__year
+ , subq_6.third_hop_ds__extract_year AS metric_time__extract_year
+ , subq_6.third_hop_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_6.third_hop_ds__extract_month AS metric_time__extract_month
+ , subq_6.third_hop_ds__extract_day AS metric_time__extract_day
+ , subq_6.third_hop_ds__extract_dow AS metric_time__extract_dow
+ , subq_6.third_hop_ds__extract_doy AS metric_time__extract_doy
+ , subq_6.customer_third_hop_id
+ , subq_6.value
+ , subq_6.customer_third_hop_id__value
+ , subq_6.third_hop_count
+ FROM (
+ -- Read Elements From Semantic Model 'third_hop_table'
+ SELECT
+ third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ , third_hop_table_src_22000.value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_day
+ , EXTRACT(isodow FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_doy
+ , third_hop_table_src_22000.value AS customer_third_hop_id__value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_day
+ , EXTRACT(isodow FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_doy
+ , third_hop_table_src_22000.customer_third_hop_id
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ ) subq_6
+ ) subq_7
+ ) subq_8
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: ['customer_id__customer_third_hop_id', 'customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ subq_15.customer_id__customer_third_hop_id
+ , subq_15.customer_id__customer_third_hop_id__paraguayan_customers
+ FROM (
+ -- Compute Metrics via Expressions
+ SELECT
+ subq_14.customer_id__customer_third_hop_id
+ , subq_14.customers_with_other_data AS customer_id__customer_third_hop_id__paraguayan_customers
+ FROM (
+ -- Aggregate Measures
+ SELECT
+ subq_13.customer_id__customer_third_hop_id
+ , SUM(subq_13.customers_with_other_data) AS customers_with_other_data
+ FROM (
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__customer_third_hop_id']
+ SELECT
+ subq_12.customer_id__customer_third_hop_id
+ , subq_12.customers_with_other_data
+ FROM (
+ -- Constrain Output with WHERE
+ SELECT
+ subq_11.customer_id__customer_third_hop_id
+ , subq_11.customer_id__country
+ , subq_11.customers_with_other_data
+ FROM (
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id']
+ SELECT
+ subq_10.customer_id__customer_third_hop_id
+ , subq_10.customer_id__country
+ , subq_10.customers_with_other_data
+ FROM (
+ -- Metric Time Dimension 'acquired_ds'
+ SELECT
+ subq_9.acquired_ds__day
+ , subq_9.acquired_ds__week
+ , subq_9.acquired_ds__month
+ , subq_9.acquired_ds__quarter
+ , subq_9.acquired_ds__year
+ , subq_9.acquired_ds__extract_year
+ , subq_9.acquired_ds__extract_quarter
+ , subq_9.acquired_ds__extract_month
+ , subq_9.acquired_ds__extract_day
+ , subq_9.acquired_ds__extract_dow
+ , subq_9.acquired_ds__extract_doy
+ , subq_9.customer_id__acquired_ds__day
+ , subq_9.customer_id__acquired_ds__week
+ , subq_9.customer_id__acquired_ds__month
+ , subq_9.customer_id__acquired_ds__quarter
+ , subq_9.customer_id__acquired_ds__year
+ , subq_9.customer_id__acquired_ds__extract_year
+ , subq_9.customer_id__acquired_ds__extract_quarter
+ , subq_9.customer_id__acquired_ds__extract_month
+ , subq_9.customer_id__acquired_ds__extract_day
+ , subq_9.customer_id__acquired_ds__extract_dow
+ , subq_9.customer_id__acquired_ds__extract_doy
+ , subq_9.customer_third_hop_id__acquired_ds__day
+ , subq_9.customer_third_hop_id__acquired_ds__week
+ , subq_9.customer_third_hop_id__acquired_ds__month
+ , subq_9.customer_third_hop_id__acquired_ds__quarter
+ , subq_9.customer_third_hop_id__acquired_ds__year
+ , subq_9.customer_third_hop_id__acquired_ds__extract_year
+ , subq_9.customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_9.customer_third_hop_id__acquired_ds__extract_month
+ , subq_9.customer_third_hop_id__acquired_ds__extract_day
+ , subq_9.customer_third_hop_id__acquired_ds__extract_dow
+ , subq_9.customer_third_hop_id__acquired_ds__extract_doy
+ , subq_9.acquired_ds__day AS metric_time__day
+ , subq_9.acquired_ds__week AS metric_time__week
+ , subq_9.acquired_ds__month AS metric_time__month
+ , subq_9.acquired_ds__quarter AS metric_time__quarter
+ , subq_9.acquired_ds__year AS metric_time__year
+ , subq_9.acquired_ds__extract_year AS metric_time__extract_year
+ , subq_9.acquired_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.acquired_ds__extract_month AS metric_time__extract_month
+ , subq_9.acquired_ds__extract_day AS metric_time__extract_day
+ , subq_9.acquired_ds__extract_dow AS metric_time__extract_dow
+ , subq_9.acquired_ds__extract_doy AS metric_time__extract_doy
+ , subq_9.customer_id
+ , subq_9.customer_third_hop_id
+ , subq_9.customer_id__customer_third_hop_id
+ , subq_9.customer_third_hop_id__customer_id
+ , subq_9.country
+ , subq_9.customer_id__country
+ , subq_9.customer_third_hop_id__country
+ , subq_9.customers_with_other_data
+ FROM (
+ -- Read Elements From Semantic Model 'customer_other_data'
+ SELECT
+ 1 AS customers_with_other_data
+ , customer_other_data_src_22000.country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_day
+ , EXTRACT(isodow FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_day
+ , EXTRACT(isodow FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_third_hop_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_day
+ , EXTRACT(isodow FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.customer_id
+ , customer_other_data_src_22000.customer_third_hop_id
+ , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id
+ , customer_other_data_src_22000.customer_id AS customer_third_hop_id__customer_id
+ FROM ***************************.customer_other_data customer_other_data_src_22000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+ WHERE customer_id__country = 'paraguay'
+ ) subq_12
+ ) subq_13
+ GROUP BY
+ subq_13.customer_id__customer_third_hop_id
+ ) subq_14
+ ) subq_15
+ ) subq_16
+ ON
+ subq_8.customer_third_hop_id = subq_16.customer_id__customer_third_hop_id
+ ) subq_17
+ ) subq_18
+ WHERE customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers > 0
+ ) subq_19
+ ) subq_20
+) subq_21
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Postgres/test_inner_query_single_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Postgres/test_inner_query_single_hop__plan0_optimized.sql
new file mode 100644
index 0000000000..2ad52ec04c
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Postgres/test_inner_query_single_hop__plan0_optimized.sql
@@ -0,0 +1,40 @@
+-- Constrain Output with WHERE
+-- Pass Only Elements: ['third_hop_count',]
+-- Aggregate Measures
+-- Compute Metrics via Expressions
+SELECT
+ COUNT(DISTINCT third_hop_count) AS third_hop_count
+FROM (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ subq_32.customer_id__customer_third_hop_id__paraguayan_customers AS customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ LEFT OUTER JOIN (
+ -- Constrain Output with WHERE
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__customer_third_hop_id']
+ -- Aggregate Measures
+ -- Compute Metrics via Expressions
+ -- Pass Only Elements: ['customer_id__customer_third_hop_id', 'customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ customer_id__customer_third_hop_id
+ , SUM(customers_with_other_data) AS customer_id__customer_third_hop_id__paraguayan_customers
+ FROM (
+ -- Read Elements From Semantic Model 'customer_other_data'
+ -- Metric Time Dimension 'acquired_ds'
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id']
+ SELECT
+ customer_third_hop_id AS customer_id__customer_third_hop_id
+ , country AS customer_id__country
+ , 1 AS customers_with_other_data
+ FROM ***************************.customer_other_data customer_other_data_src_22000
+ ) subq_27
+ WHERE customer_id__country = 'paraguay'
+ GROUP BY
+ customer_id__customer_third_hop_id
+ ) subq_32
+ ON
+ third_hop_table_src_22000.customer_third_hop_id = subq_32.customer_id__customer_third_hop_id
+) subq_34
+WHERE customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers > 0
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Redshift/test_inner_query_multi_hop__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Redshift/test_inner_query_multi_hop__plan0.sql
new file mode 100644
index 0000000000..2bb04ef38c
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Redshift/test_inner_query_multi_hop__plan0.sql
@@ -0,0 +1,694 @@
+-- Compute Metrics via Expressions
+SELECT
+ subq_40.third_hop_count
+FROM (
+ -- Aggregate Measures
+ SELECT
+ COUNT(DISTINCT subq_39.third_hop_count) AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count',]
+ SELECT
+ subq_38.third_hop_count
+ FROM (
+ -- Constrain Output with WHERE
+ SELECT
+ subq_37.customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , subq_37.third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_36.customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , subq_36.third_hop_count
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_20.customer_third_hop_id AS customer_third_hop_id
+ , subq_35.account_id__customer_id__customer_third_hop_id AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id
+ , subq_35.account_id__customer_id__customer_third_hop_id__txn_count AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , subq_20.third_hop_count AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id']
+ SELECT
+ subq_19.customer_third_hop_id
+ , subq_19.third_hop_count
+ FROM (
+ -- Metric Time Dimension 'third_hop_ds'
+ SELECT
+ subq_18.third_hop_ds__day
+ , subq_18.third_hop_ds__week
+ , subq_18.third_hop_ds__month
+ , subq_18.third_hop_ds__quarter
+ , subq_18.third_hop_ds__year
+ , subq_18.third_hop_ds__extract_year
+ , subq_18.third_hop_ds__extract_quarter
+ , subq_18.third_hop_ds__extract_month
+ , subq_18.third_hop_ds__extract_day
+ , subq_18.third_hop_ds__extract_dow
+ , subq_18.third_hop_ds__extract_doy
+ , subq_18.customer_third_hop_id__third_hop_ds__day
+ , subq_18.customer_third_hop_id__third_hop_ds__week
+ , subq_18.customer_third_hop_id__third_hop_ds__month
+ , subq_18.customer_third_hop_id__third_hop_ds__quarter
+ , subq_18.customer_third_hop_id__third_hop_ds__year
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_year
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_quarter
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_month
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_day
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_dow
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_doy
+ , subq_18.third_hop_ds__day AS metric_time__day
+ , subq_18.third_hop_ds__week AS metric_time__week
+ , subq_18.third_hop_ds__month AS metric_time__month
+ , subq_18.third_hop_ds__quarter AS metric_time__quarter
+ , subq_18.third_hop_ds__year AS metric_time__year
+ , subq_18.third_hop_ds__extract_year AS metric_time__extract_year
+ , subq_18.third_hop_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_18.third_hop_ds__extract_month AS metric_time__extract_month
+ , subq_18.third_hop_ds__extract_day AS metric_time__extract_day
+ , subq_18.third_hop_ds__extract_dow AS metric_time__extract_dow
+ , subq_18.third_hop_ds__extract_doy AS metric_time__extract_doy
+ , subq_18.customer_third_hop_id
+ , subq_18.value
+ , subq_18.customer_third_hop_id__value
+ , subq_18.third_hop_count
+ FROM (
+ -- Read Elements From Semantic Model 'third_hop_table'
+ SELECT
+ third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ , third_hop_table_src_22000.value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM third_hop_table_src_22000.third_hop_ds) = 0 THEN EXTRACT(dow FROM third_hop_table_src_22000.third_hop_ds) + 7 ELSE EXTRACT(dow FROM third_hop_table_src_22000.third_hop_ds) END AS third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_doy
+ , third_hop_table_src_22000.value AS customer_third_hop_id__value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM third_hop_table_src_22000.third_hop_ds) = 0 THEN EXTRACT(dow FROM third_hop_table_src_22000.third_hop_ds) + 7 ELSE EXTRACT(dow FROM third_hop_table_src_22000.third_hop_ds) END AS customer_third_hop_id__third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_doy
+ , third_hop_table_src_22000.customer_third_hop_id
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ ) subq_18
+ ) subq_19
+ ) subq_20
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: ['account_id__customer_id__customer_third_hop_id', 'account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_34.account_id__customer_id__customer_third_hop_id
+ , subq_34.account_id__customer_id__customer_third_hop_id__txn_count
+ FROM (
+ -- Compute Metrics via Expressions
+ SELECT
+ subq_33.account_id__customer_id__customer_third_hop_id
+ , subq_33.txn_count AS account_id__customer_id__customer_third_hop_id__txn_count
+ FROM (
+ -- Aggregate Measures
+ SELECT
+ subq_32.account_id__customer_id__customer_third_hop_id
+ , SUM(subq_32.txn_count) AS txn_count
+ FROM (
+ -- Pass Only Elements: ['txn_count', 'account_id__customer_id__customer_third_hop_id']
+ SELECT
+ subq_31.account_id__customer_id__customer_third_hop_id
+ , subq_31.txn_count
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_23.ds_partitioned__day AS ds_partitioned__day
+ , subq_30.ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_23.account_id AS account_id
+ , subq_30.customer_id__customer_third_hop_id AS account_id__customer_id__customer_third_hop_id
+ , subq_23.txn_count AS txn_count
+ FROM (
+ -- Pass Only Elements: ['txn_count', 'ds_partitioned__day', 'account_id']
+ SELECT
+ subq_22.ds_partitioned__day
+ , subq_22.account_id
+ , subq_22.txn_count
+ FROM (
+ -- Metric Time Dimension 'ds'
+ SELECT
+ subq_21.ds_partitioned__day
+ , subq_21.ds_partitioned__week
+ , subq_21.ds_partitioned__month
+ , subq_21.ds_partitioned__quarter
+ , subq_21.ds_partitioned__year
+ , subq_21.ds_partitioned__extract_year
+ , subq_21.ds_partitioned__extract_quarter
+ , subq_21.ds_partitioned__extract_month
+ , subq_21.ds_partitioned__extract_day
+ , subq_21.ds_partitioned__extract_dow
+ , subq_21.ds_partitioned__extract_doy
+ , subq_21.ds__day
+ , subq_21.ds__week
+ , subq_21.ds__month
+ , subq_21.ds__quarter
+ , subq_21.ds__year
+ , subq_21.ds__extract_year
+ , subq_21.ds__extract_quarter
+ , subq_21.ds__extract_month
+ , subq_21.ds__extract_day
+ , subq_21.ds__extract_dow
+ , subq_21.ds__extract_doy
+ , subq_21.account_id__ds_partitioned__day
+ , subq_21.account_id__ds_partitioned__week
+ , subq_21.account_id__ds_partitioned__month
+ , subq_21.account_id__ds_partitioned__quarter
+ , subq_21.account_id__ds_partitioned__year
+ , subq_21.account_id__ds_partitioned__extract_year
+ , subq_21.account_id__ds_partitioned__extract_quarter
+ , subq_21.account_id__ds_partitioned__extract_month
+ , subq_21.account_id__ds_partitioned__extract_day
+ , subq_21.account_id__ds_partitioned__extract_dow
+ , subq_21.account_id__ds_partitioned__extract_doy
+ , subq_21.account_id__ds__day
+ , subq_21.account_id__ds__week
+ , subq_21.account_id__ds__month
+ , subq_21.account_id__ds__quarter
+ , subq_21.account_id__ds__year
+ , subq_21.account_id__ds__extract_year
+ , subq_21.account_id__ds__extract_quarter
+ , subq_21.account_id__ds__extract_month
+ , subq_21.account_id__ds__extract_day
+ , subq_21.account_id__ds__extract_dow
+ , subq_21.account_id__ds__extract_doy
+ , subq_21.ds__day AS metric_time__day
+ , subq_21.ds__week AS metric_time__week
+ , subq_21.ds__month AS metric_time__month
+ , subq_21.ds__quarter AS metric_time__quarter
+ , subq_21.ds__year AS metric_time__year
+ , subq_21.ds__extract_year AS metric_time__extract_year
+ , subq_21.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_21.ds__extract_month AS metric_time__extract_month
+ , subq_21.ds__extract_day AS metric_time__extract_day
+ , subq_21.ds__extract_dow AS metric_time__extract_dow
+ , subq_21.ds__extract_doy AS metric_time__extract_doy
+ , subq_21.account_id
+ , subq_21.account_month
+ , subq_21.account_id__account_month
+ , subq_21.txn_count
+ FROM (
+ -- Read Elements From Semantic Model 'account_month_txns'
+ SELECT
+ account_month_txns_src_22000.txn_count
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , CASE WHEN EXTRACT(dow FROM account_month_txns_src_22000.ds_partitioned) = 0 THEN EXTRACT(dow FROM account_month_txns_src_22000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM account_month_txns_src_22000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS ds__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS ds__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS ds__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS ds__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS ds__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds) AS ds__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS ds__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds) AS ds__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds) AS ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM account_month_txns_src_22000.ds) = 0 THEN EXTRACT(dow FROM account_month_txns_src_22000.ds) + 7 ELSE EXTRACT(dow FROM account_month_txns_src_22000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS ds__extract_doy
+ , account_month_txns_src_22000.account_month
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
+ , CASE WHEN EXTRACT(dow FROM account_month_txns_src_22000.ds_partitioned) = 0 THEN EXTRACT(dow FROM account_month_txns_src_22000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM account_month_txns_src_22000.ds_partitioned) END AS account_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS account_id__ds__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS account_id__ds__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS account_id__ds__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS account_id__ds__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS account_id__ds__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM account_month_txns_src_22000.ds) = 0 THEN EXTRACT(dow FROM account_month_txns_src_22000.ds) + 7 ELSE EXTRACT(dow FROM account_month_txns_src_22000.ds) END AS account_id__ds__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_doy
+ , account_month_txns_src_22000.account_month AS account_id__account_month
+ , account_month_txns_src_22000.account_id
+ FROM ***************************.account_month_txns account_month_txns_src_22000
+ ) subq_21
+ ) subq_22
+ ) subq_23
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: ['ds_partitioned__day', 'account_id', 'customer_id__customer_third_hop_id']
+ SELECT
+ subq_29.ds_partitioned__day
+ , subq_29.account_id
+ , subq_29.customer_id__customer_third_hop_id
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_25.ds_partitioned__day AS ds_partitioned__day
+ , subq_25.ds_partitioned__week AS ds_partitioned__week
+ , subq_25.ds_partitioned__month AS ds_partitioned__month
+ , subq_25.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_25.ds_partitioned__year AS ds_partitioned__year
+ , subq_25.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_25.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_25.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_25.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_25.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_25.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_25.account_id__ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_25.account_id__ds_partitioned__week AS account_id__ds_partitioned__week
+ , subq_25.account_id__ds_partitioned__month AS account_id__ds_partitioned__month
+ , subq_25.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter
+ , subq_25.account_id__ds_partitioned__year AS account_id__ds_partitioned__year
+ , subq_25.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year
+ , subq_25.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter
+ , subq_25.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month
+ , subq_25.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day
+ , subq_25.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow
+ , subq_25.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy
+ , subq_25.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day
+ , subq_25.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week
+ , subq_25.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month
+ , subq_25.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter
+ , subq_25.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year
+ , subq_25.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year
+ , subq_25.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter
+ , subq_25.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month
+ , subq_25.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day
+ , subq_25.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow
+ , subq_25.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy
+ , subq_25.metric_time__day AS metric_time__day
+ , subq_25.metric_time__week AS metric_time__week
+ , subq_25.metric_time__month AS metric_time__month
+ , subq_25.metric_time__quarter AS metric_time__quarter
+ , subq_25.metric_time__year AS metric_time__year
+ , subq_25.metric_time__extract_year AS metric_time__extract_year
+ , subq_25.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_25.metric_time__extract_month AS metric_time__extract_month
+ , subq_25.metric_time__extract_day AS metric_time__extract_day
+ , subq_25.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_25.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_28.acquired_ds__day AS customer_id__acquired_ds__day
+ , subq_28.acquired_ds__week AS customer_id__acquired_ds__week
+ , subq_28.acquired_ds__month AS customer_id__acquired_ds__month
+ , subq_28.acquired_ds__quarter AS customer_id__acquired_ds__quarter
+ , subq_28.acquired_ds__year AS customer_id__acquired_ds__year
+ , subq_28.acquired_ds__extract_year AS customer_id__acquired_ds__extract_year
+ , subq_28.acquired_ds__extract_quarter AS customer_id__acquired_ds__extract_quarter
+ , subq_28.acquired_ds__extract_month AS customer_id__acquired_ds__extract_month
+ , subq_28.acquired_ds__extract_day AS customer_id__acquired_ds__extract_day
+ , subq_28.acquired_ds__extract_dow AS customer_id__acquired_ds__extract_dow
+ , subq_28.acquired_ds__extract_doy AS customer_id__acquired_ds__extract_doy
+ , subq_28.customer_third_hop_id__acquired_ds__day AS customer_id__customer_third_hop_id__acquired_ds__day
+ , subq_28.customer_third_hop_id__acquired_ds__week AS customer_id__customer_third_hop_id__acquired_ds__week
+ , subq_28.customer_third_hop_id__acquired_ds__month AS customer_id__customer_third_hop_id__acquired_ds__month
+ , subq_28.customer_third_hop_id__acquired_ds__quarter AS customer_id__customer_third_hop_id__acquired_ds__quarter
+ , subq_28.customer_third_hop_id__acquired_ds__year AS customer_id__customer_third_hop_id__acquired_ds__year
+ , subq_28.customer_third_hop_id__acquired_ds__extract_year AS customer_id__customer_third_hop_id__acquired_ds__extract_year
+ , subq_28.customer_third_hop_id__acquired_ds__extract_quarter AS customer_id__customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_28.customer_third_hop_id__acquired_ds__extract_month AS customer_id__customer_third_hop_id__acquired_ds__extract_month
+ , subq_28.customer_third_hop_id__acquired_ds__extract_day AS customer_id__customer_third_hop_id__acquired_ds__extract_day
+ , subq_28.customer_third_hop_id__acquired_ds__extract_dow AS customer_id__customer_third_hop_id__acquired_ds__extract_dow
+ , subq_28.customer_third_hop_id__acquired_ds__extract_doy AS customer_id__customer_third_hop_id__acquired_ds__extract_doy
+ , subq_28.metric_time__day AS customer_id__metric_time__day
+ , subq_28.metric_time__week AS customer_id__metric_time__week
+ , subq_28.metric_time__month AS customer_id__metric_time__month
+ , subq_28.metric_time__quarter AS customer_id__metric_time__quarter
+ , subq_28.metric_time__year AS customer_id__metric_time__year
+ , subq_28.metric_time__extract_year AS customer_id__metric_time__extract_year
+ , subq_28.metric_time__extract_quarter AS customer_id__metric_time__extract_quarter
+ , subq_28.metric_time__extract_month AS customer_id__metric_time__extract_month
+ , subq_28.metric_time__extract_day AS customer_id__metric_time__extract_day
+ , subq_28.metric_time__extract_dow AS customer_id__metric_time__extract_dow
+ , subq_28.metric_time__extract_doy AS customer_id__metric_time__extract_doy
+ , subq_25.account_id AS account_id
+ , subq_25.customer_id AS customer_id
+ , subq_25.account_id__customer_id AS account_id__customer_id
+ , subq_25.bridge_account__account_id AS bridge_account__account_id
+ , subq_25.bridge_account__customer_id AS bridge_account__customer_id
+ , subq_28.customer_third_hop_id AS customer_id__customer_third_hop_id
+ , subq_28.customer_third_hop_id__customer_id AS customer_id__customer_third_hop_id__customer_id
+ , subq_25.extra_dim AS extra_dim
+ , subq_25.account_id__extra_dim AS account_id__extra_dim
+ , subq_25.bridge_account__extra_dim AS bridge_account__extra_dim
+ , subq_28.country AS customer_id__country
+ , subq_28.customer_third_hop_id__country AS customer_id__customer_third_hop_id__country
+ , subq_25.account_customer_combos AS account_customer_combos
+ FROM (
+ -- Metric Time Dimension 'ds_partitioned'
+ SELECT
+ subq_24.ds_partitioned__day
+ , subq_24.ds_partitioned__week
+ , subq_24.ds_partitioned__month
+ , subq_24.ds_partitioned__quarter
+ , subq_24.ds_partitioned__year
+ , subq_24.ds_partitioned__extract_year
+ , subq_24.ds_partitioned__extract_quarter
+ , subq_24.ds_partitioned__extract_month
+ , subq_24.ds_partitioned__extract_day
+ , subq_24.ds_partitioned__extract_dow
+ , subq_24.ds_partitioned__extract_doy
+ , subq_24.account_id__ds_partitioned__day
+ , subq_24.account_id__ds_partitioned__week
+ , subq_24.account_id__ds_partitioned__month
+ , subq_24.account_id__ds_partitioned__quarter
+ , subq_24.account_id__ds_partitioned__year
+ , subq_24.account_id__ds_partitioned__extract_year
+ , subq_24.account_id__ds_partitioned__extract_quarter
+ , subq_24.account_id__ds_partitioned__extract_month
+ , subq_24.account_id__ds_partitioned__extract_day
+ , subq_24.account_id__ds_partitioned__extract_dow
+ , subq_24.account_id__ds_partitioned__extract_doy
+ , subq_24.bridge_account__ds_partitioned__day
+ , subq_24.bridge_account__ds_partitioned__week
+ , subq_24.bridge_account__ds_partitioned__month
+ , subq_24.bridge_account__ds_partitioned__quarter
+ , subq_24.bridge_account__ds_partitioned__year
+ , subq_24.bridge_account__ds_partitioned__extract_year
+ , subq_24.bridge_account__ds_partitioned__extract_quarter
+ , subq_24.bridge_account__ds_partitioned__extract_month
+ , subq_24.bridge_account__ds_partitioned__extract_day
+ , subq_24.bridge_account__ds_partitioned__extract_dow
+ , subq_24.bridge_account__ds_partitioned__extract_doy
+ , subq_24.ds_partitioned__day AS metric_time__day
+ , subq_24.ds_partitioned__week AS metric_time__week
+ , subq_24.ds_partitioned__month AS metric_time__month
+ , subq_24.ds_partitioned__quarter AS metric_time__quarter
+ , subq_24.ds_partitioned__year AS metric_time__year
+ , subq_24.ds_partitioned__extract_year AS metric_time__extract_year
+ , subq_24.ds_partitioned__extract_quarter AS metric_time__extract_quarter
+ , subq_24.ds_partitioned__extract_month AS metric_time__extract_month
+ , subq_24.ds_partitioned__extract_day AS metric_time__extract_day
+ , subq_24.ds_partitioned__extract_dow AS metric_time__extract_dow
+ , subq_24.ds_partitioned__extract_doy AS metric_time__extract_doy
+ , subq_24.account_id
+ , subq_24.customer_id
+ , subq_24.account_id__customer_id
+ , subq_24.bridge_account__account_id
+ , subq_24.bridge_account__customer_id
+ , subq_24.extra_dim
+ , subq_24.account_id__extra_dim
+ , subq_24.bridge_account__extra_dim
+ , subq_24.account_customer_combos
+ FROM (
+ -- Read Elements From Semantic Model 'bridge_table'
+ SELECT
+ account_id || customer_id AS account_customer_combos
+ , bridge_table_src_22000.extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , CASE WHEN EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS account_id__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
+ , CASE WHEN EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) END AS account_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_day
+ , CASE WHEN EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) END AS bridge_account__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy
+ , bridge_table_src_22000.account_id
+ , bridge_table_src_22000.customer_id
+ , bridge_table_src_22000.customer_id AS account_id__customer_id
+ , bridge_table_src_22000.account_id AS bridge_account__account_id
+ , bridge_table_src_22000.customer_id AS bridge_account__customer_id
+ FROM ***************************.bridge_table bridge_table_src_22000
+ ) subq_24
+ ) subq_25
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: [
+ -- 'country',
+ -- 'customer_id__country',
+ -- 'customer_third_hop_id__country',
+ -- 'acquired_ds__day',
+ -- 'acquired_ds__week',
+ -- 'acquired_ds__month',
+ -- 'acquired_ds__quarter',
+ -- 'acquired_ds__year',
+ -- 'acquired_ds__extract_year',
+ -- 'acquired_ds__extract_quarter',
+ -- 'acquired_ds__extract_month',
+ -- 'acquired_ds__extract_day',
+ -- 'acquired_ds__extract_dow',
+ -- 'acquired_ds__extract_doy',
+ -- 'customer_id__acquired_ds__day',
+ -- 'customer_id__acquired_ds__week',
+ -- 'customer_id__acquired_ds__month',
+ -- 'customer_id__acquired_ds__quarter',
+ -- 'customer_id__acquired_ds__year',
+ -- 'customer_id__acquired_ds__extract_year',
+ -- 'customer_id__acquired_ds__extract_quarter',
+ -- 'customer_id__acquired_ds__extract_month',
+ -- 'customer_id__acquired_ds__extract_day',
+ -- 'customer_id__acquired_ds__extract_dow',
+ -- 'customer_id__acquired_ds__extract_doy',
+ -- 'customer_third_hop_id__acquired_ds__day',
+ -- 'customer_third_hop_id__acquired_ds__week',
+ -- 'customer_third_hop_id__acquired_ds__month',
+ -- 'customer_third_hop_id__acquired_ds__quarter',
+ -- 'customer_third_hop_id__acquired_ds__year',
+ -- 'customer_third_hop_id__acquired_ds__extract_year',
+ -- 'customer_third_hop_id__acquired_ds__extract_quarter',
+ -- 'customer_third_hop_id__acquired_ds__extract_month',
+ -- 'customer_third_hop_id__acquired_ds__extract_day',
+ -- 'customer_third_hop_id__acquired_ds__extract_dow',
+ -- 'customer_third_hop_id__acquired_ds__extract_doy',
+ -- 'metric_time__day',
+ -- 'metric_time__week',
+ -- 'metric_time__month',
+ -- 'metric_time__quarter',
+ -- 'metric_time__year',
+ -- 'metric_time__extract_year',
+ -- 'metric_time__extract_quarter',
+ -- 'metric_time__extract_month',
+ -- 'metric_time__extract_day',
+ -- 'metric_time__extract_dow',
+ -- 'metric_time__extract_doy',
+ -- 'customer_id',
+ -- 'customer_third_hop_id',
+ -- 'customer_id__customer_third_hop_id',
+ -- 'customer_third_hop_id__customer_id',
+ -- ]
+ SELECT
+ subq_27.acquired_ds__day
+ , subq_27.acquired_ds__week
+ , subq_27.acquired_ds__month
+ , subq_27.acquired_ds__quarter
+ , subq_27.acquired_ds__year
+ , subq_27.acquired_ds__extract_year
+ , subq_27.acquired_ds__extract_quarter
+ , subq_27.acquired_ds__extract_month
+ , subq_27.acquired_ds__extract_day
+ , subq_27.acquired_ds__extract_dow
+ , subq_27.acquired_ds__extract_doy
+ , subq_27.customer_id__acquired_ds__day
+ , subq_27.customer_id__acquired_ds__week
+ , subq_27.customer_id__acquired_ds__month
+ , subq_27.customer_id__acquired_ds__quarter
+ , subq_27.customer_id__acquired_ds__year
+ , subq_27.customer_id__acquired_ds__extract_year
+ , subq_27.customer_id__acquired_ds__extract_quarter
+ , subq_27.customer_id__acquired_ds__extract_month
+ , subq_27.customer_id__acquired_ds__extract_day
+ , subq_27.customer_id__acquired_ds__extract_dow
+ , subq_27.customer_id__acquired_ds__extract_doy
+ , subq_27.customer_third_hop_id__acquired_ds__day
+ , subq_27.customer_third_hop_id__acquired_ds__week
+ , subq_27.customer_third_hop_id__acquired_ds__month
+ , subq_27.customer_third_hop_id__acquired_ds__quarter
+ , subq_27.customer_third_hop_id__acquired_ds__year
+ , subq_27.customer_third_hop_id__acquired_ds__extract_year
+ , subq_27.customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_27.customer_third_hop_id__acquired_ds__extract_month
+ , subq_27.customer_third_hop_id__acquired_ds__extract_day
+ , subq_27.customer_third_hop_id__acquired_ds__extract_dow
+ , subq_27.customer_third_hop_id__acquired_ds__extract_doy
+ , subq_27.metric_time__day
+ , subq_27.metric_time__week
+ , subq_27.metric_time__month
+ , subq_27.metric_time__quarter
+ , subq_27.metric_time__year
+ , subq_27.metric_time__extract_year
+ , subq_27.metric_time__extract_quarter
+ , subq_27.metric_time__extract_month
+ , subq_27.metric_time__extract_day
+ , subq_27.metric_time__extract_dow
+ , subq_27.metric_time__extract_doy
+ , subq_27.customer_id
+ , subq_27.customer_third_hop_id
+ , subq_27.customer_id__customer_third_hop_id
+ , subq_27.customer_third_hop_id__customer_id
+ , subq_27.country
+ , subq_27.customer_id__country
+ , subq_27.customer_third_hop_id__country
+ FROM (
+ -- Metric Time Dimension 'acquired_ds'
+ SELECT
+ subq_26.acquired_ds__day
+ , subq_26.acquired_ds__week
+ , subq_26.acquired_ds__month
+ , subq_26.acquired_ds__quarter
+ , subq_26.acquired_ds__year
+ , subq_26.acquired_ds__extract_year
+ , subq_26.acquired_ds__extract_quarter
+ , subq_26.acquired_ds__extract_month
+ , subq_26.acquired_ds__extract_day
+ , subq_26.acquired_ds__extract_dow
+ , subq_26.acquired_ds__extract_doy
+ , subq_26.customer_id__acquired_ds__day
+ , subq_26.customer_id__acquired_ds__week
+ , subq_26.customer_id__acquired_ds__month
+ , subq_26.customer_id__acquired_ds__quarter
+ , subq_26.customer_id__acquired_ds__year
+ , subq_26.customer_id__acquired_ds__extract_year
+ , subq_26.customer_id__acquired_ds__extract_quarter
+ , subq_26.customer_id__acquired_ds__extract_month
+ , subq_26.customer_id__acquired_ds__extract_day
+ , subq_26.customer_id__acquired_ds__extract_dow
+ , subq_26.customer_id__acquired_ds__extract_doy
+ , subq_26.customer_third_hop_id__acquired_ds__day
+ , subq_26.customer_third_hop_id__acquired_ds__week
+ , subq_26.customer_third_hop_id__acquired_ds__month
+ , subq_26.customer_third_hop_id__acquired_ds__quarter
+ , subq_26.customer_third_hop_id__acquired_ds__year
+ , subq_26.customer_third_hop_id__acquired_ds__extract_year
+ , subq_26.customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_26.customer_third_hop_id__acquired_ds__extract_month
+ , subq_26.customer_third_hop_id__acquired_ds__extract_day
+ , subq_26.customer_third_hop_id__acquired_ds__extract_dow
+ , subq_26.customer_third_hop_id__acquired_ds__extract_doy
+ , subq_26.acquired_ds__day AS metric_time__day
+ , subq_26.acquired_ds__week AS metric_time__week
+ , subq_26.acquired_ds__month AS metric_time__month
+ , subq_26.acquired_ds__quarter AS metric_time__quarter
+ , subq_26.acquired_ds__year AS metric_time__year
+ , subq_26.acquired_ds__extract_year AS metric_time__extract_year
+ , subq_26.acquired_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_26.acquired_ds__extract_month AS metric_time__extract_month
+ , subq_26.acquired_ds__extract_day AS metric_time__extract_day
+ , subq_26.acquired_ds__extract_dow AS metric_time__extract_dow
+ , subq_26.acquired_ds__extract_doy AS metric_time__extract_doy
+ , subq_26.customer_id
+ , subq_26.customer_third_hop_id
+ , subq_26.customer_id__customer_third_hop_id
+ , subq_26.customer_third_hop_id__customer_id
+ , subq_26.country
+ , subq_26.customer_id__country
+ , subq_26.customer_third_hop_id__country
+ , subq_26.customers_with_other_data
+ FROM (
+ -- Read Elements From Semantic Model 'customer_other_data'
+ SELECT
+ 1 AS customers_with_other_data
+ , customer_other_data_src_22000.country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM customer_other_data_src_22000.acquired_ds) = 0 THEN EXTRACT(dow FROM customer_other_data_src_22000.acquired_ds) + 7 ELSE EXTRACT(dow FROM customer_other_data_src_22000.acquired_ds) END AS acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM customer_other_data_src_22000.acquired_ds) = 0 THEN EXTRACT(dow FROM customer_other_data_src_22000.acquired_ds) + 7 ELSE EXTRACT(dow FROM customer_other_data_src_22000.acquired_ds) END AS customer_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_third_hop_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM customer_other_data_src_22000.acquired_ds) = 0 THEN EXTRACT(dow FROM customer_other_data_src_22000.acquired_ds) + 7 ELSE EXTRACT(dow FROM customer_other_data_src_22000.acquired_ds) END AS customer_third_hop_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.customer_id
+ , customer_other_data_src_22000.customer_third_hop_id
+ , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id
+ , customer_other_data_src_22000.customer_id AS customer_third_hop_id__customer_id
+ FROM ***************************.customer_other_data customer_other_data_src_22000
+ ) subq_26
+ ) subq_27
+ ) subq_28
+ ON
+ subq_25.customer_id = subq_28.customer_id
+ ) subq_29
+ ) subq_30
+ ON
+ (
+ subq_23.account_id = subq_30.account_id
+ ) AND (
+ subq_23.ds_partitioned__day = subq_30.ds_partitioned__day
+ )
+ ) subq_31
+ ) subq_32
+ GROUP BY
+ subq_32.account_id__customer_id__customer_third_hop_id
+ ) subq_33
+ ) subq_34
+ ) subq_35
+ ON
+ subq_20.customer_third_hop_id = subq_35.account_id__customer_id__customer_third_hop_id
+ ) subq_36
+ ) subq_37
+ WHERE customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count > 2
+ ) subq_38
+ ) subq_39
+) subq_40
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Redshift/test_inner_query_multi_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Redshift/test_inner_query_multi_hop__plan0_optimized.sql
new file mode 100644
index 0000000000..d195b8867f
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Redshift/test_inner_query_multi_hop__plan0_optimized.sql
@@ -0,0 +1,49 @@
+-- Constrain Output with WHERE
+-- Pass Only Elements: ['third_hop_count',]
+-- Aggregate Measures
+-- Compute Metrics via Expressions
+SELECT
+ COUNT(DISTINCT third_hop_count) AS third_hop_count
+FROM (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_58.account_id__customer_id__customer_third_hop_id__txn_count AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ LEFT OUTER JOIN (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['txn_count', 'account_id__customer_id__customer_third_hop_id']
+ -- Aggregate Measures
+ -- Compute Metrics via Expressions
+ -- Pass Only Elements: ['account_id__customer_id__customer_third_hop_id', 'account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_53.customer_id__customer_third_hop_id AS account_id__customer_id__customer_third_hop_id
+ , SUM(account_month_txns_src_22000.txn_count) AS account_id__customer_id__customer_third_hop_id__txn_count
+ FROM ***************************.account_month_txns account_month_txns_src_22000
+ LEFT OUTER JOIN (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['ds_partitioned__day', 'account_id', 'customer_id__customer_third_hop_id']
+ SELECT
+ DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , bridge_table_src_22000.account_id AS account_id
+ , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id
+ FROM ***************************.bridge_table bridge_table_src_22000
+ LEFT OUTER JOIN
+ ***************************.customer_other_data customer_other_data_src_22000
+ ON
+ bridge_table_src_22000.customer_id = customer_other_data_src_22000.customer_id
+ ) subq_53
+ ON
+ (
+ account_month_txns_src_22000.account_id = subq_53.account_id
+ ) AND (
+ DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_53.ds_partitioned__day
+ )
+ GROUP BY
+ subq_53.customer_id__customer_third_hop_id
+ ) subq_58
+ ON
+ third_hop_table_src_22000.customer_third_hop_id = subq_58.account_id__customer_id__customer_third_hop_id
+) subq_60
+WHERE customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count > 2
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Redshift/test_inner_query_single_hop__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Redshift/test_inner_query_single_hop__plan0.sql
new file mode 100644
index 0000000000..f881118554
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Redshift/test_inner_query_single_hop__plan0.sql
@@ -0,0 +1,257 @@
+-- Compute Metrics via Expressions
+SELECT
+ subq_21.third_hop_count
+FROM (
+ -- Aggregate Measures
+ SELECT
+ COUNT(DISTINCT subq_20.third_hop_count) AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count',]
+ SELECT
+ subq_19.third_hop_count
+ FROM (
+ -- Constrain Output with WHERE
+ SELECT
+ subq_18.customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , subq_18.third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ subq_17.customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , subq_17.third_hop_count
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_8.customer_third_hop_id AS customer_third_hop_id
+ , subq_16.customer_id__customer_third_hop_id AS customer_third_hop_id__customer_id__customer_third_hop_id
+ , subq_16.customer_id__customer_third_hop_id__paraguayan_customers AS customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , subq_8.third_hop_count AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id']
+ SELECT
+ subq_7.customer_third_hop_id
+ , subq_7.third_hop_count
+ FROM (
+ -- Metric Time Dimension 'third_hop_ds'
+ SELECT
+ subq_6.third_hop_ds__day
+ , subq_6.third_hop_ds__week
+ , subq_6.third_hop_ds__month
+ , subq_6.third_hop_ds__quarter
+ , subq_6.third_hop_ds__year
+ , subq_6.third_hop_ds__extract_year
+ , subq_6.third_hop_ds__extract_quarter
+ , subq_6.third_hop_ds__extract_month
+ , subq_6.third_hop_ds__extract_day
+ , subq_6.third_hop_ds__extract_dow
+ , subq_6.third_hop_ds__extract_doy
+ , subq_6.customer_third_hop_id__third_hop_ds__day
+ , subq_6.customer_third_hop_id__third_hop_ds__week
+ , subq_6.customer_third_hop_id__third_hop_ds__month
+ , subq_6.customer_third_hop_id__third_hop_ds__quarter
+ , subq_6.customer_third_hop_id__third_hop_ds__year
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_year
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_quarter
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_month
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_day
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_dow
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_doy
+ , subq_6.third_hop_ds__day AS metric_time__day
+ , subq_6.third_hop_ds__week AS metric_time__week
+ , subq_6.third_hop_ds__month AS metric_time__month
+ , subq_6.third_hop_ds__quarter AS metric_time__quarter
+ , subq_6.third_hop_ds__year AS metric_time__year
+ , subq_6.third_hop_ds__extract_year AS metric_time__extract_year
+ , subq_6.third_hop_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_6.third_hop_ds__extract_month AS metric_time__extract_month
+ , subq_6.third_hop_ds__extract_day AS metric_time__extract_day
+ , subq_6.third_hop_ds__extract_dow AS metric_time__extract_dow
+ , subq_6.third_hop_ds__extract_doy AS metric_time__extract_doy
+ , subq_6.customer_third_hop_id
+ , subq_6.value
+ , subq_6.customer_third_hop_id__value
+ , subq_6.third_hop_count
+ FROM (
+ -- Read Elements From Semantic Model 'third_hop_table'
+ SELECT
+ third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ , third_hop_table_src_22000.value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM third_hop_table_src_22000.third_hop_ds) = 0 THEN EXTRACT(dow FROM third_hop_table_src_22000.third_hop_ds) + 7 ELSE EXTRACT(dow FROM third_hop_table_src_22000.third_hop_ds) END AS third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_doy
+ , third_hop_table_src_22000.value AS customer_third_hop_id__value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM third_hop_table_src_22000.third_hop_ds) = 0 THEN EXTRACT(dow FROM third_hop_table_src_22000.third_hop_ds) + 7 ELSE EXTRACT(dow FROM third_hop_table_src_22000.third_hop_ds) END AS customer_third_hop_id__third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_doy
+ , third_hop_table_src_22000.customer_third_hop_id
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ ) subq_6
+ ) subq_7
+ ) subq_8
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: ['customer_id__customer_third_hop_id', 'customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ subq_15.customer_id__customer_third_hop_id
+ , subq_15.customer_id__customer_third_hop_id__paraguayan_customers
+ FROM (
+ -- Compute Metrics via Expressions
+ SELECT
+ subq_14.customer_id__customer_third_hop_id
+ , subq_14.customers_with_other_data AS customer_id__customer_third_hop_id__paraguayan_customers
+ FROM (
+ -- Aggregate Measures
+ SELECT
+ subq_13.customer_id__customer_third_hop_id
+ , SUM(subq_13.customers_with_other_data) AS customers_with_other_data
+ FROM (
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__customer_third_hop_id']
+ SELECT
+ subq_12.customer_id__customer_third_hop_id
+ , subq_12.customers_with_other_data
+ FROM (
+ -- Constrain Output with WHERE
+ SELECT
+ subq_11.customer_id__customer_third_hop_id
+ , subq_11.customer_id__country
+ , subq_11.customers_with_other_data
+ FROM (
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id']
+ SELECT
+ subq_10.customer_id__customer_third_hop_id
+ , subq_10.customer_id__country
+ , subq_10.customers_with_other_data
+ FROM (
+ -- Metric Time Dimension 'acquired_ds'
+ SELECT
+ subq_9.acquired_ds__day
+ , subq_9.acquired_ds__week
+ , subq_9.acquired_ds__month
+ , subq_9.acquired_ds__quarter
+ , subq_9.acquired_ds__year
+ , subq_9.acquired_ds__extract_year
+ , subq_9.acquired_ds__extract_quarter
+ , subq_9.acquired_ds__extract_month
+ , subq_9.acquired_ds__extract_day
+ , subq_9.acquired_ds__extract_dow
+ , subq_9.acquired_ds__extract_doy
+ , subq_9.customer_id__acquired_ds__day
+ , subq_9.customer_id__acquired_ds__week
+ , subq_9.customer_id__acquired_ds__month
+ , subq_9.customer_id__acquired_ds__quarter
+ , subq_9.customer_id__acquired_ds__year
+ , subq_9.customer_id__acquired_ds__extract_year
+ , subq_9.customer_id__acquired_ds__extract_quarter
+ , subq_9.customer_id__acquired_ds__extract_month
+ , subq_9.customer_id__acquired_ds__extract_day
+ , subq_9.customer_id__acquired_ds__extract_dow
+ , subq_9.customer_id__acquired_ds__extract_doy
+ , subq_9.customer_third_hop_id__acquired_ds__day
+ , subq_9.customer_third_hop_id__acquired_ds__week
+ , subq_9.customer_third_hop_id__acquired_ds__month
+ , subq_9.customer_third_hop_id__acquired_ds__quarter
+ , subq_9.customer_third_hop_id__acquired_ds__year
+ , subq_9.customer_third_hop_id__acquired_ds__extract_year
+ , subq_9.customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_9.customer_third_hop_id__acquired_ds__extract_month
+ , subq_9.customer_third_hop_id__acquired_ds__extract_day
+ , subq_9.customer_third_hop_id__acquired_ds__extract_dow
+ , subq_9.customer_third_hop_id__acquired_ds__extract_doy
+ , subq_9.acquired_ds__day AS metric_time__day
+ , subq_9.acquired_ds__week AS metric_time__week
+ , subq_9.acquired_ds__month AS metric_time__month
+ , subq_9.acquired_ds__quarter AS metric_time__quarter
+ , subq_9.acquired_ds__year AS metric_time__year
+ , subq_9.acquired_ds__extract_year AS metric_time__extract_year
+ , subq_9.acquired_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.acquired_ds__extract_month AS metric_time__extract_month
+ , subq_9.acquired_ds__extract_day AS metric_time__extract_day
+ , subq_9.acquired_ds__extract_dow AS metric_time__extract_dow
+ , subq_9.acquired_ds__extract_doy AS metric_time__extract_doy
+ , subq_9.customer_id
+ , subq_9.customer_third_hop_id
+ , subq_9.customer_id__customer_third_hop_id
+ , subq_9.customer_third_hop_id__customer_id
+ , subq_9.country
+ , subq_9.customer_id__country
+ , subq_9.customer_third_hop_id__country
+ , subq_9.customers_with_other_data
+ FROM (
+ -- Read Elements From Semantic Model 'customer_other_data'
+ SELECT
+ 1 AS customers_with_other_data
+ , customer_other_data_src_22000.country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM customer_other_data_src_22000.acquired_ds) = 0 THEN EXTRACT(dow FROM customer_other_data_src_22000.acquired_ds) + 7 ELSE EXTRACT(dow FROM customer_other_data_src_22000.acquired_ds) END AS acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM customer_other_data_src_22000.acquired_ds) = 0 THEN EXTRACT(dow FROM customer_other_data_src_22000.acquired_ds) + 7 ELSE EXTRACT(dow FROM customer_other_data_src_22000.acquired_ds) END AS customer_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_third_hop_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM customer_other_data_src_22000.acquired_ds) = 0 THEN EXTRACT(dow FROM customer_other_data_src_22000.acquired_ds) + 7 ELSE EXTRACT(dow FROM customer_other_data_src_22000.acquired_ds) END AS customer_third_hop_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.customer_id
+ , customer_other_data_src_22000.customer_third_hop_id
+ , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id
+ , customer_other_data_src_22000.customer_id AS customer_third_hop_id__customer_id
+ FROM ***************************.customer_other_data customer_other_data_src_22000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+ WHERE customer_id__country = 'paraguay'
+ ) subq_12
+ ) subq_13
+ GROUP BY
+ subq_13.customer_id__customer_third_hop_id
+ ) subq_14
+ ) subq_15
+ ) subq_16
+ ON
+ subq_8.customer_third_hop_id = subq_16.customer_id__customer_third_hop_id
+ ) subq_17
+ ) subq_18
+ WHERE customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers > 0
+ ) subq_19
+ ) subq_20
+) subq_21
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Redshift/test_inner_query_single_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Redshift/test_inner_query_single_hop__plan0_optimized.sql
new file mode 100644
index 0000000000..2ad52ec04c
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Redshift/test_inner_query_single_hop__plan0_optimized.sql
@@ -0,0 +1,40 @@
+-- Constrain Output with WHERE
+-- Pass Only Elements: ['third_hop_count',]
+-- Aggregate Measures
+-- Compute Metrics via Expressions
+SELECT
+ COUNT(DISTINCT third_hop_count) AS third_hop_count
+FROM (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ subq_32.customer_id__customer_third_hop_id__paraguayan_customers AS customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ LEFT OUTER JOIN (
+ -- Constrain Output with WHERE
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__customer_third_hop_id']
+ -- Aggregate Measures
+ -- Compute Metrics via Expressions
+ -- Pass Only Elements: ['customer_id__customer_third_hop_id', 'customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ customer_id__customer_third_hop_id
+ , SUM(customers_with_other_data) AS customer_id__customer_third_hop_id__paraguayan_customers
+ FROM (
+ -- Read Elements From Semantic Model 'customer_other_data'
+ -- Metric Time Dimension 'acquired_ds'
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id']
+ SELECT
+ customer_third_hop_id AS customer_id__customer_third_hop_id
+ , country AS customer_id__country
+ , 1 AS customers_with_other_data
+ FROM ***************************.customer_other_data customer_other_data_src_22000
+ ) subq_27
+ WHERE customer_id__country = 'paraguay'
+ GROUP BY
+ customer_id__customer_third_hop_id
+ ) subq_32
+ ON
+ third_hop_table_src_22000.customer_third_hop_id = subq_32.customer_id__customer_third_hop_id
+) subq_34
+WHERE customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers > 0
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Snowflake/test_inner_query_multi_hop__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Snowflake/test_inner_query_multi_hop__plan0.sql
new file mode 100644
index 0000000000..0411633312
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Snowflake/test_inner_query_multi_hop__plan0.sql
@@ -0,0 +1,694 @@
+-- Compute Metrics via Expressions
+SELECT
+ subq_40.third_hop_count
+FROM (
+ -- Aggregate Measures
+ SELECT
+ COUNT(DISTINCT subq_39.third_hop_count) AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count',]
+ SELECT
+ subq_38.third_hop_count
+ FROM (
+ -- Constrain Output with WHERE
+ SELECT
+ subq_37.customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , subq_37.third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_36.customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , subq_36.third_hop_count
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_20.customer_third_hop_id AS customer_third_hop_id
+ , subq_35.account_id__customer_id__customer_third_hop_id AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id
+ , subq_35.account_id__customer_id__customer_third_hop_id__txn_count AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , subq_20.third_hop_count AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id']
+ SELECT
+ subq_19.customer_third_hop_id
+ , subq_19.third_hop_count
+ FROM (
+ -- Metric Time Dimension 'third_hop_ds'
+ SELECT
+ subq_18.third_hop_ds__day
+ , subq_18.third_hop_ds__week
+ , subq_18.third_hop_ds__month
+ , subq_18.third_hop_ds__quarter
+ , subq_18.third_hop_ds__year
+ , subq_18.third_hop_ds__extract_year
+ , subq_18.third_hop_ds__extract_quarter
+ , subq_18.third_hop_ds__extract_month
+ , subq_18.third_hop_ds__extract_day
+ , subq_18.third_hop_ds__extract_dow
+ , subq_18.third_hop_ds__extract_doy
+ , subq_18.customer_third_hop_id__third_hop_ds__day
+ , subq_18.customer_third_hop_id__third_hop_ds__week
+ , subq_18.customer_third_hop_id__third_hop_ds__month
+ , subq_18.customer_third_hop_id__third_hop_ds__quarter
+ , subq_18.customer_third_hop_id__third_hop_ds__year
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_year
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_quarter
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_month
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_day
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_dow
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_doy
+ , subq_18.third_hop_ds__day AS metric_time__day
+ , subq_18.third_hop_ds__week AS metric_time__week
+ , subq_18.third_hop_ds__month AS metric_time__month
+ , subq_18.third_hop_ds__quarter AS metric_time__quarter
+ , subq_18.third_hop_ds__year AS metric_time__year
+ , subq_18.third_hop_ds__extract_year AS metric_time__extract_year
+ , subq_18.third_hop_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_18.third_hop_ds__extract_month AS metric_time__extract_month
+ , subq_18.third_hop_ds__extract_day AS metric_time__extract_day
+ , subq_18.third_hop_ds__extract_dow AS metric_time__extract_dow
+ , subq_18.third_hop_ds__extract_doy AS metric_time__extract_doy
+ , subq_18.customer_third_hop_id
+ , subq_18.value
+ , subq_18.customer_third_hop_id__value
+ , subq_18.third_hop_count
+ FROM (
+ -- Read Elements From Semantic Model 'third_hop_table'
+ SELECT
+ third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ , third_hop_table_src_22000.value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_day
+ , EXTRACT(dayofweekiso FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_doy
+ , third_hop_table_src_22000.value AS customer_third_hop_id__value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_day
+ , EXTRACT(dayofweekiso FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_doy
+ , third_hop_table_src_22000.customer_third_hop_id
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ ) subq_18
+ ) subq_19
+ ) subq_20
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: ['account_id__customer_id__customer_third_hop_id', 'account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_34.account_id__customer_id__customer_third_hop_id
+ , subq_34.account_id__customer_id__customer_third_hop_id__txn_count
+ FROM (
+ -- Compute Metrics via Expressions
+ SELECT
+ subq_33.account_id__customer_id__customer_third_hop_id
+ , subq_33.txn_count AS account_id__customer_id__customer_third_hop_id__txn_count
+ FROM (
+ -- Aggregate Measures
+ SELECT
+ subq_32.account_id__customer_id__customer_third_hop_id
+ , SUM(subq_32.txn_count) AS txn_count
+ FROM (
+ -- Pass Only Elements: ['txn_count', 'account_id__customer_id__customer_third_hop_id']
+ SELECT
+ subq_31.account_id__customer_id__customer_third_hop_id
+ , subq_31.txn_count
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_23.ds_partitioned__day AS ds_partitioned__day
+ , subq_30.ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_23.account_id AS account_id
+ , subq_30.customer_id__customer_third_hop_id AS account_id__customer_id__customer_third_hop_id
+ , subq_23.txn_count AS txn_count
+ FROM (
+ -- Pass Only Elements: ['txn_count', 'ds_partitioned__day', 'account_id']
+ SELECT
+ subq_22.ds_partitioned__day
+ , subq_22.account_id
+ , subq_22.txn_count
+ FROM (
+ -- Metric Time Dimension 'ds'
+ SELECT
+ subq_21.ds_partitioned__day
+ , subq_21.ds_partitioned__week
+ , subq_21.ds_partitioned__month
+ , subq_21.ds_partitioned__quarter
+ , subq_21.ds_partitioned__year
+ , subq_21.ds_partitioned__extract_year
+ , subq_21.ds_partitioned__extract_quarter
+ , subq_21.ds_partitioned__extract_month
+ , subq_21.ds_partitioned__extract_day
+ , subq_21.ds_partitioned__extract_dow
+ , subq_21.ds_partitioned__extract_doy
+ , subq_21.ds__day
+ , subq_21.ds__week
+ , subq_21.ds__month
+ , subq_21.ds__quarter
+ , subq_21.ds__year
+ , subq_21.ds__extract_year
+ , subq_21.ds__extract_quarter
+ , subq_21.ds__extract_month
+ , subq_21.ds__extract_day
+ , subq_21.ds__extract_dow
+ , subq_21.ds__extract_doy
+ , subq_21.account_id__ds_partitioned__day
+ , subq_21.account_id__ds_partitioned__week
+ , subq_21.account_id__ds_partitioned__month
+ , subq_21.account_id__ds_partitioned__quarter
+ , subq_21.account_id__ds_partitioned__year
+ , subq_21.account_id__ds_partitioned__extract_year
+ , subq_21.account_id__ds_partitioned__extract_quarter
+ , subq_21.account_id__ds_partitioned__extract_month
+ , subq_21.account_id__ds_partitioned__extract_day
+ , subq_21.account_id__ds_partitioned__extract_dow
+ , subq_21.account_id__ds_partitioned__extract_doy
+ , subq_21.account_id__ds__day
+ , subq_21.account_id__ds__week
+ , subq_21.account_id__ds__month
+ , subq_21.account_id__ds__quarter
+ , subq_21.account_id__ds__year
+ , subq_21.account_id__ds__extract_year
+ , subq_21.account_id__ds__extract_quarter
+ , subq_21.account_id__ds__extract_month
+ , subq_21.account_id__ds__extract_day
+ , subq_21.account_id__ds__extract_dow
+ , subq_21.account_id__ds__extract_doy
+ , subq_21.ds__day AS metric_time__day
+ , subq_21.ds__week AS metric_time__week
+ , subq_21.ds__month AS metric_time__month
+ , subq_21.ds__quarter AS metric_time__quarter
+ , subq_21.ds__year AS metric_time__year
+ , subq_21.ds__extract_year AS metric_time__extract_year
+ , subq_21.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_21.ds__extract_month AS metric_time__extract_month
+ , subq_21.ds__extract_day AS metric_time__extract_day
+ , subq_21.ds__extract_dow AS metric_time__extract_dow
+ , subq_21.ds__extract_doy AS metric_time__extract_doy
+ , subq_21.account_id
+ , subq_21.account_month
+ , subq_21.account_id__account_month
+ , subq_21.txn_count
+ FROM (
+ -- Read Elements From Semantic Model 'account_month_txns'
+ SELECT
+ account_month_txns_src_22000.txn_count
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(dayofweekiso FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS ds__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS ds__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS ds__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS ds__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS ds__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds) AS ds__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS ds__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds) AS ds__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds) AS ds__extract_day
+ , EXTRACT(dayofweekiso FROM account_month_txns_src_22000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS ds__extract_doy
+ , account_month_txns_src_22000.account_month
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
+ , EXTRACT(dayofweekiso FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS account_id__ds__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS account_id__ds__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS account_id__ds__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS account_id__ds__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS account_id__ds__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_day
+ , EXTRACT(dayofweekiso FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_doy
+ , account_month_txns_src_22000.account_month AS account_id__account_month
+ , account_month_txns_src_22000.account_id
+ FROM ***************************.account_month_txns account_month_txns_src_22000
+ ) subq_21
+ ) subq_22
+ ) subq_23
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: ['ds_partitioned__day', 'account_id', 'customer_id__customer_third_hop_id']
+ SELECT
+ subq_29.ds_partitioned__day
+ , subq_29.account_id
+ , subq_29.customer_id__customer_third_hop_id
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_25.ds_partitioned__day AS ds_partitioned__day
+ , subq_25.ds_partitioned__week AS ds_partitioned__week
+ , subq_25.ds_partitioned__month AS ds_partitioned__month
+ , subq_25.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_25.ds_partitioned__year AS ds_partitioned__year
+ , subq_25.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_25.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_25.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_25.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_25.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_25.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_25.account_id__ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_25.account_id__ds_partitioned__week AS account_id__ds_partitioned__week
+ , subq_25.account_id__ds_partitioned__month AS account_id__ds_partitioned__month
+ , subq_25.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter
+ , subq_25.account_id__ds_partitioned__year AS account_id__ds_partitioned__year
+ , subq_25.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year
+ , subq_25.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter
+ , subq_25.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month
+ , subq_25.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day
+ , subq_25.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow
+ , subq_25.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy
+ , subq_25.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day
+ , subq_25.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week
+ , subq_25.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month
+ , subq_25.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter
+ , subq_25.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year
+ , subq_25.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year
+ , subq_25.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter
+ , subq_25.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month
+ , subq_25.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day
+ , subq_25.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow
+ , subq_25.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy
+ , subq_25.metric_time__day AS metric_time__day
+ , subq_25.metric_time__week AS metric_time__week
+ , subq_25.metric_time__month AS metric_time__month
+ , subq_25.metric_time__quarter AS metric_time__quarter
+ , subq_25.metric_time__year AS metric_time__year
+ , subq_25.metric_time__extract_year AS metric_time__extract_year
+ , subq_25.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_25.metric_time__extract_month AS metric_time__extract_month
+ , subq_25.metric_time__extract_day AS metric_time__extract_day
+ , subq_25.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_25.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_28.acquired_ds__day AS customer_id__acquired_ds__day
+ , subq_28.acquired_ds__week AS customer_id__acquired_ds__week
+ , subq_28.acquired_ds__month AS customer_id__acquired_ds__month
+ , subq_28.acquired_ds__quarter AS customer_id__acquired_ds__quarter
+ , subq_28.acquired_ds__year AS customer_id__acquired_ds__year
+ , subq_28.acquired_ds__extract_year AS customer_id__acquired_ds__extract_year
+ , subq_28.acquired_ds__extract_quarter AS customer_id__acquired_ds__extract_quarter
+ , subq_28.acquired_ds__extract_month AS customer_id__acquired_ds__extract_month
+ , subq_28.acquired_ds__extract_day AS customer_id__acquired_ds__extract_day
+ , subq_28.acquired_ds__extract_dow AS customer_id__acquired_ds__extract_dow
+ , subq_28.acquired_ds__extract_doy AS customer_id__acquired_ds__extract_doy
+ , subq_28.customer_third_hop_id__acquired_ds__day AS customer_id__customer_third_hop_id__acquired_ds__day
+ , subq_28.customer_third_hop_id__acquired_ds__week AS customer_id__customer_third_hop_id__acquired_ds__week
+ , subq_28.customer_third_hop_id__acquired_ds__month AS customer_id__customer_third_hop_id__acquired_ds__month
+ , subq_28.customer_third_hop_id__acquired_ds__quarter AS customer_id__customer_third_hop_id__acquired_ds__quarter
+ , subq_28.customer_third_hop_id__acquired_ds__year AS customer_id__customer_third_hop_id__acquired_ds__year
+ , subq_28.customer_third_hop_id__acquired_ds__extract_year AS customer_id__customer_third_hop_id__acquired_ds__extract_year
+ , subq_28.customer_third_hop_id__acquired_ds__extract_quarter AS customer_id__customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_28.customer_third_hop_id__acquired_ds__extract_month AS customer_id__customer_third_hop_id__acquired_ds__extract_month
+ , subq_28.customer_third_hop_id__acquired_ds__extract_day AS customer_id__customer_third_hop_id__acquired_ds__extract_day
+ , subq_28.customer_third_hop_id__acquired_ds__extract_dow AS customer_id__customer_third_hop_id__acquired_ds__extract_dow
+ , subq_28.customer_third_hop_id__acquired_ds__extract_doy AS customer_id__customer_third_hop_id__acquired_ds__extract_doy
+ , subq_28.metric_time__day AS customer_id__metric_time__day
+ , subq_28.metric_time__week AS customer_id__metric_time__week
+ , subq_28.metric_time__month AS customer_id__metric_time__month
+ , subq_28.metric_time__quarter AS customer_id__metric_time__quarter
+ , subq_28.metric_time__year AS customer_id__metric_time__year
+ , subq_28.metric_time__extract_year AS customer_id__metric_time__extract_year
+ , subq_28.metric_time__extract_quarter AS customer_id__metric_time__extract_quarter
+ , subq_28.metric_time__extract_month AS customer_id__metric_time__extract_month
+ , subq_28.metric_time__extract_day AS customer_id__metric_time__extract_day
+ , subq_28.metric_time__extract_dow AS customer_id__metric_time__extract_dow
+ , subq_28.metric_time__extract_doy AS customer_id__metric_time__extract_doy
+ , subq_25.account_id AS account_id
+ , subq_25.customer_id AS customer_id
+ , subq_25.account_id__customer_id AS account_id__customer_id
+ , subq_25.bridge_account__account_id AS bridge_account__account_id
+ , subq_25.bridge_account__customer_id AS bridge_account__customer_id
+ , subq_28.customer_third_hop_id AS customer_id__customer_third_hop_id
+ , subq_28.customer_third_hop_id__customer_id AS customer_id__customer_third_hop_id__customer_id
+ , subq_25.extra_dim AS extra_dim
+ , subq_25.account_id__extra_dim AS account_id__extra_dim
+ , subq_25.bridge_account__extra_dim AS bridge_account__extra_dim
+ , subq_28.country AS customer_id__country
+ , subq_28.customer_third_hop_id__country AS customer_id__customer_third_hop_id__country
+ , subq_25.account_customer_combos AS account_customer_combos
+ FROM (
+ -- Metric Time Dimension 'ds_partitioned'
+ SELECT
+ subq_24.ds_partitioned__day
+ , subq_24.ds_partitioned__week
+ , subq_24.ds_partitioned__month
+ , subq_24.ds_partitioned__quarter
+ , subq_24.ds_partitioned__year
+ , subq_24.ds_partitioned__extract_year
+ , subq_24.ds_partitioned__extract_quarter
+ , subq_24.ds_partitioned__extract_month
+ , subq_24.ds_partitioned__extract_day
+ , subq_24.ds_partitioned__extract_dow
+ , subq_24.ds_partitioned__extract_doy
+ , subq_24.account_id__ds_partitioned__day
+ , subq_24.account_id__ds_partitioned__week
+ , subq_24.account_id__ds_partitioned__month
+ , subq_24.account_id__ds_partitioned__quarter
+ , subq_24.account_id__ds_partitioned__year
+ , subq_24.account_id__ds_partitioned__extract_year
+ , subq_24.account_id__ds_partitioned__extract_quarter
+ , subq_24.account_id__ds_partitioned__extract_month
+ , subq_24.account_id__ds_partitioned__extract_day
+ , subq_24.account_id__ds_partitioned__extract_dow
+ , subq_24.account_id__ds_partitioned__extract_doy
+ , subq_24.bridge_account__ds_partitioned__day
+ , subq_24.bridge_account__ds_partitioned__week
+ , subq_24.bridge_account__ds_partitioned__month
+ , subq_24.bridge_account__ds_partitioned__quarter
+ , subq_24.bridge_account__ds_partitioned__year
+ , subq_24.bridge_account__ds_partitioned__extract_year
+ , subq_24.bridge_account__ds_partitioned__extract_quarter
+ , subq_24.bridge_account__ds_partitioned__extract_month
+ , subq_24.bridge_account__ds_partitioned__extract_day
+ , subq_24.bridge_account__ds_partitioned__extract_dow
+ , subq_24.bridge_account__ds_partitioned__extract_doy
+ , subq_24.ds_partitioned__day AS metric_time__day
+ , subq_24.ds_partitioned__week AS metric_time__week
+ , subq_24.ds_partitioned__month AS metric_time__month
+ , subq_24.ds_partitioned__quarter AS metric_time__quarter
+ , subq_24.ds_partitioned__year AS metric_time__year
+ , subq_24.ds_partitioned__extract_year AS metric_time__extract_year
+ , subq_24.ds_partitioned__extract_quarter AS metric_time__extract_quarter
+ , subq_24.ds_partitioned__extract_month AS metric_time__extract_month
+ , subq_24.ds_partitioned__extract_day AS metric_time__extract_day
+ , subq_24.ds_partitioned__extract_dow AS metric_time__extract_dow
+ , subq_24.ds_partitioned__extract_doy AS metric_time__extract_doy
+ , subq_24.account_id
+ , subq_24.customer_id
+ , subq_24.account_id__customer_id
+ , subq_24.bridge_account__account_id
+ , subq_24.bridge_account__customer_id
+ , subq_24.extra_dim
+ , subq_24.account_id__extra_dim
+ , subq_24.bridge_account__extra_dim
+ , subq_24.account_customer_combos
+ FROM (
+ -- Read Elements From Semantic Model 'bridge_table'
+ SELECT
+ account_id || customer_id AS account_customer_combos
+ , bridge_table_src_22000.extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(dayofweekiso FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS account_id__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
+ , EXTRACT(dayofweekiso FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_day
+ , EXTRACT(dayofweekiso FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy
+ , bridge_table_src_22000.account_id
+ , bridge_table_src_22000.customer_id
+ , bridge_table_src_22000.customer_id AS account_id__customer_id
+ , bridge_table_src_22000.account_id AS bridge_account__account_id
+ , bridge_table_src_22000.customer_id AS bridge_account__customer_id
+ FROM ***************************.bridge_table bridge_table_src_22000
+ ) subq_24
+ ) subq_25
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: [
+ -- 'country',
+ -- 'customer_id__country',
+ -- 'customer_third_hop_id__country',
+ -- 'acquired_ds__day',
+ -- 'acquired_ds__week',
+ -- 'acquired_ds__month',
+ -- 'acquired_ds__quarter',
+ -- 'acquired_ds__year',
+ -- 'acquired_ds__extract_year',
+ -- 'acquired_ds__extract_quarter',
+ -- 'acquired_ds__extract_month',
+ -- 'acquired_ds__extract_day',
+ -- 'acquired_ds__extract_dow',
+ -- 'acquired_ds__extract_doy',
+ -- 'customer_id__acquired_ds__day',
+ -- 'customer_id__acquired_ds__week',
+ -- 'customer_id__acquired_ds__month',
+ -- 'customer_id__acquired_ds__quarter',
+ -- 'customer_id__acquired_ds__year',
+ -- 'customer_id__acquired_ds__extract_year',
+ -- 'customer_id__acquired_ds__extract_quarter',
+ -- 'customer_id__acquired_ds__extract_month',
+ -- 'customer_id__acquired_ds__extract_day',
+ -- 'customer_id__acquired_ds__extract_dow',
+ -- 'customer_id__acquired_ds__extract_doy',
+ -- 'customer_third_hop_id__acquired_ds__day',
+ -- 'customer_third_hop_id__acquired_ds__week',
+ -- 'customer_third_hop_id__acquired_ds__month',
+ -- 'customer_third_hop_id__acquired_ds__quarter',
+ -- 'customer_third_hop_id__acquired_ds__year',
+ -- 'customer_third_hop_id__acquired_ds__extract_year',
+ -- 'customer_third_hop_id__acquired_ds__extract_quarter',
+ -- 'customer_third_hop_id__acquired_ds__extract_month',
+ -- 'customer_third_hop_id__acquired_ds__extract_day',
+ -- 'customer_third_hop_id__acquired_ds__extract_dow',
+ -- 'customer_third_hop_id__acquired_ds__extract_doy',
+ -- 'metric_time__day',
+ -- 'metric_time__week',
+ -- 'metric_time__month',
+ -- 'metric_time__quarter',
+ -- 'metric_time__year',
+ -- 'metric_time__extract_year',
+ -- 'metric_time__extract_quarter',
+ -- 'metric_time__extract_month',
+ -- 'metric_time__extract_day',
+ -- 'metric_time__extract_dow',
+ -- 'metric_time__extract_doy',
+ -- 'customer_id',
+ -- 'customer_third_hop_id',
+ -- 'customer_id__customer_third_hop_id',
+ -- 'customer_third_hop_id__customer_id',
+ -- ]
+ SELECT
+ subq_27.acquired_ds__day
+ , subq_27.acquired_ds__week
+ , subq_27.acquired_ds__month
+ , subq_27.acquired_ds__quarter
+ , subq_27.acquired_ds__year
+ , subq_27.acquired_ds__extract_year
+ , subq_27.acquired_ds__extract_quarter
+ , subq_27.acquired_ds__extract_month
+ , subq_27.acquired_ds__extract_day
+ , subq_27.acquired_ds__extract_dow
+ , subq_27.acquired_ds__extract_doy
+ , subq_27.customer_id__acquired_ds__day
+ , subq_27.customer_id__acquired_ds__week
+ , subq_27.customer_id__acquired_ds__month
+ , subq_27.customer_id__acquired_ds__quarter
+ , subq_27.customer_id__acquired_ds__year
+ , subq_27.customer_id__acquired_ds__extract_year
+ , subq_27.customer_id__acquired_ds__extract_quarter
+ , subq_27.customer_id__acquired_ds__extract_month
+ , subq_27.customer_id__acquired_ds__extract_day
+ , subq_27.customer_id__acquired_ds__extract_dow
+ , subq_27.customer_id__acquired_ds__extract_doy
+ , subq_27.customer_third_hop_id__acquired_ds__day
+ , subq_27.customer_third_hop_id__acquired_ds__week
+ , subq_27.customer_third_hop_id__acquired_ds__month
+ , subq_27.customer_third_hop_id__acquired_ds__quarter
+ , subq_27.customer_third_hop_id__acquired_ds__year
+ , subq_27.customer_third_hop_id__acquired_ds__extract_year
+ , subq_27.customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_27.customer_third_hop_id__acquired_ds__extract_month
+ , subq_27.customer_third_hop_id__acquired_ds__extract_day
+ , subq_27.customer_third_hop_id__acquired_ds__extract_dow
+ , subq_27.customer_third_hop_id__acquired_ds__extract_doy
+ , subq_27.metric_time__day
+ , subq_27.metric_time__week
+ , subq_27.metric_time__month
+ , subq_27.metric_time__quarter
+ , subq_27.metric_time__year
+ , subq_27.metric_time__extract_year
+ , subq_27.metric_time__extract_quarter
+ , subq_27.metric_time__extract_month
+ , subq_27.metric_time__extract_day
+ , subq_27.metric_time__extract_dow
+ , subq_27.metric_time__extract_doy
+ , subq_27.customer_id
+ , subq_27.customer_third_hop_id
+ , subq_27.customer_id__customer_third_hop_id
+ , subq_27.customer_third_hop_id__customer_id
+ , subq_27.country
+ , subq_27.customer_id__country
+ , subq_27.customer_third_hop_id__country
+ FROM (
+ -- Metric Time Dimension 'acquired_ds'
+ SELECT
+ subq_26.acquired_ds__day
+ , subq_26.acquired_ds__week
+ , subq_26.acquired_ds__month
+ , subq_26.acquired_ds__quarter
+ , subq_26.acquired_ds__year
+ , subq_26.acquired_ds__extract_year
+ , subq_26.acquired_ds__extract_quarter
+ , subq_26.acquired_ds__extract_month
+ , subq_26.acquired_ds__extract_day
+ , subq_26.acquired_ds__extract_dow
+ , subq_26.acquired_ds__extract_doy
+ , subq_26.customer_id__acquired_ds__day
+ , subq_26.customer_id__acquired_ds__week
+ , subq_26.customer_id__acquired_ds__month
+ , subq_26.customer_id__acquired_ds__quarter
+ , subq_26.customer_id__acquired_ds__year
+ , subq_26.customer_id__acquired_ds__extract_year
+ , subq_26.customer_id__acquired_ds__extract_quarter
+ , subq_26.customer_id__acquired_ds__extract_month
+ , subq_26.customer_id__acquired_ds__extract_day
+ , subq_26.customer_id__acquired_ds__extract_dow
+ , subq_26.customer_id__acquired_ds__extract_doy
+ , subq_26.customer_third_hop_id__acquired_ds__day
+ , subq_26.customer_third_hop_id__acquired_ds__week
+ , subq_26.customer_third_hop_id__acquired_ds__month
+ , subq_26.customer_third_hop_id__acquired_ds__quarter
+ , subq_26.customer_third_hop_id__acquired_ds__year
+ , subq_26.customer_third_hop_id__acquired_ds__extract_year
+ , subq_26.customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_26.customer_third_hop_id__acquired_ds__extract_month
+ , subq_26.customer_third_hop_id__acquired_ds__extract_day
+ , subq_26.customer_third_hop_id__acquired_ds__extract_dow
+ , subq_26.customer_third_hop_id__acquired_ds__extract_doy
+ , subq_26.acquired_ds__day AS metric_time__day
+ , subq_26.acquired_ds__week AS metric_time__week
+ , subq_26.acquired_ds__month AS metric_time__month
+ , subq_26.acquired_ds__quarter AS metric_time__quarter
+ , subq_26.acquired_ds__year AS metric_time__year
+ , subq_26.acquired_ds__extract_year AS metric_time__extract_year
+ , subq_26.acquired_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_26.acquired_ds__extract_month AS metric_time__extract_month
+ , subq_26.acquired_ds__extract_day AS metric_time__extract_day
+ , subq_26.acquired_ds__extract_dow AS metric_time__extract_dow
+ , subq_26.acquired_ds__extract_doy AS metric_time__extract_doy
+ , subq_26.customer_id
+ , subq_26.customer_third_hop_id
+ , subq_26.customer_id__customer_third_hop_id
+ , subq_26.customer_third_hop_id__customer_id
+ , subq_26.country
+ , subq_26.customer_id__country
+ , subq_26.customer_third_hop_id__country
+ , subq_26.customers_with_other_data
+ FROM (
+ -- Read Elements From Semantic Model 'customer_other_data'
+ SELECT
+ 1 AS customers_with_other_data
+ , customer_other_data_src_22000.country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_day
+ , EXTRACT(dayofweekiso FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_day
+ , EXTRACT(dayofweekiso FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_third_hop_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_day
+ , EXTRACT(dayofweekiso FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.customer_id
+ , customer_other_data_src_22000.customer_third_hop_id
+ , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id
+ , customer_other_data_src_22000.customer_id AS customer_third_hop_id__customer_id
+ FROM ***************************.customer_other_data customer_other_data_src_22000
+ ) subq_26
+ ) subq_27
+ ) subq_28
+ ON
+ subq_25.customer_id = subq_28.customer_id
+ ) subq_29
+ ) subq_30
+ ON
+ (
+ subq_23.account_id = subq_30.account_id
+ ) AND (
+ subq_23.ds_partitioned__day = subq_30.ds_partitioned__day
+ )
+ ) subq_31
+ ) subq_32
+ GROUP BY
+ subq_32.account_id__customer_id__customer_third_hop_id
+ ) subq_33
+ ) subq_34
+ ) subq_35
+ ON
+ subq_20.customer_third_hop_id = subq_35.account_id__customer_id__customer_third_hop_id
+ ) subq_36
+ ) subq_37
+ WHERE customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count > 2
+ ) subq_38
+ ) subq_39
+) subq_40
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Snowflake/test_inner_query_multi_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Snowflake/test_inner_query_multi_hop__plan0_optimized.sql
new file mode 100644
index 0000000000..d195b8867f
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Snowflake/test_inner_query_multi_hop__plan0_optimized.sql
@@ -0,0 +1,49 @@
+-- Constrain Output with WHERE
+-- Pass Only Elements: ['third_hop_count',]
+-- Aggregate Measures
+-- Compute Metrics via Expressions
+SELECT
+ COUNT(DISTINCT third_hop_count) AS third_hop_count
+FROM (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_58.account_id__customer_id__customer_third_hop_id__txn_count AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ LEFT OUTER JOIN (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['txn_count', 'account_id__customer_id__customer_third_hop_id']
+ -- Aggregate Measures
+ -- Compute Metrics via Expressions
+ -- Pass Only Elements: ['account_id__customer_id__customer_third_hop_id', 'account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_53.customer_id__customer_third_hop_id AS account_id__customer_id__customer_third_hop_id
+ , SUM(account_month_txns_src_22000.txn_count) AS account_id__customer_id__customer_third_hop_id__txn_count
+ FROM ***************************.account_month_txns account_month_txns_src_22000
+ LEFT OUTER JOIN (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['ds_partitioned__day', 'account_id', 'customer_id__customer_third_hop_id']
+ SELECT
+ DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , bridge_table_src_22000.account_id AS account_id
+ , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id
+ FROM ***************************.bridge_table bridge_table_src_22000
+ LEFT OUTER JOIN
+ ***************************.customer_other_data customer_other_data_src_22000
+ ON
+ bridge_table_src_22000.customer_id = customer_other_data_src_22000.customer_id
+ ) subq_53
+ ON
+ (
+ account_month_txns_src_22000.account_id = subq_53.account_id
+ ) AND (
+ DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_53.ds_partitioned__day
+ )
+ GROUP BY
+ subq_53.customer_id__customer_third_hop_id
+ ) subq_58
+ ON
+ third_hop_table_src_22000.customer_third_hop_id = subq_58.account_id__customer_id__customer_third_hop_id
+) subq_60
+WHERE customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count > 2
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Snowflake/test_inner_query_single_hop__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Snowflake/test_inner_query_single_hop__plan0.sql
new file mode 100644
index 0000000000..9cebbd1f96
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Snowflake/test_inner_query_single_hop__plan0.sql
@@ -0,0 +1,257 @@
+-- Compute Metrics via Expressions
+SELECT
+ subq_21.third_hop_count
+FROM (
+ -- Aggregate Measures
+ SELECT
+ COUNT(DISTINCT subq_20.third_hop_count) AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count',]
+ SELECT
+ subq_19.third_hop_count
+ FROM (
+ -- Constrain Output with WHERE
+ SELECT
+ subq_18.customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , subq_18.third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ subq_17.customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , subq_17.third_hop_count
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_8.customer_third_hop_id AS customer_third_hop_id
+ , subq_16.customer_id__customer_third_hop_id AS customer_third_hop_id__customer_id__customer_third_hop_id
+ , subq_16.customer_id__customer_third_hop_id__paraguayan_customers AS customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , subq_8.third_hop_count AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id']
+ SELECT
+ subq_7.customer_third_hop_id
+ , subq_7.third_hop_count
+ FROM (
+ -- Metric Time Dimension 'third_hop_ds'
+ SELECT
+ subq_6.third_hop_ds__day
+ , subq_6.third_hop_ds__week
+ , subq_6.third_hop_ds__month
+ , subq_6.third_hop_ds__quarter
+ , subq_6.third_hop_ds__year
+ , subq_6.third_hop_ds__extract_year
+ , subq_6.third_hop_ds__extract_quarter
+ , subq_6.third_hop_ds__extract_month
+ , subq_6.third_hop_ds__extract_day
+ , subq_6.third_hop_ds__extract_dow
+ , subq_6.third_hop_ds__extract_doy
+ , subq_6.customer_third_hop_id__third_hop_ds__day
+ , subq_6.customer_third_hop_id__third_hop_ds__week
+ , subq_6.customer_third_hop_id__third_hop_ds__month
+ , subq_6.customer_third_hop_id__third_hop_ds__quarter
+ , subq_6.customer_third_hop_id__third_hop_ds__year
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_year
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_quarter
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_month
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_day
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_dow
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_doy
+ , subq_6.third_hop_ds__day AS metric_time__day
+ , subq_6.third_hop_ds__week AS metric_time__week
+ , subq_6.third_hop_ds__month AS metric_time__month
+ , subq_6.third_hop_ds__quarter AS metric_time__quarter
+ , subq_6.third_hop_ds__year AS metric_time__year
+ , subq_6.third_hop_ds__extract_year AS metric_time__extract_year
+ , subq_6.third_hop_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_6.third_hop_ds__extract_month AS metric_time__extract_month
+ , subq_6.third_hop_ds__extract_day AS metric_time__extract_day
+ , subq_6.third_hop_ds__extract_dow AS metric_time__extract_dow
+ , subq_6.third_hop_ds__extract_doy AS metric_time__extract_doy
+ , subq_6.customer_third_hop_id
+ , subq_6.value
+ , subq_6.customer_third_hop_id__value
+ , subq_6.third_hop_count
+ FROM (
+ -- Read Elements From Semantic Model 'third_hop_table'
+ SELECT
+ third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ , third_hop_table_src_22000.value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_day
+ , EXTRACT(dayofweekiso FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_doy
+ , third_hop_table_src_22000.value AS customer_third_hop_id__value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_day
+ , EXTRACT(dayofweekiso FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_doy
+ , third_hop_table_src_22000.customer_third_hop_id
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ ) subq_6
+ ) subq_7
+ ) subq_8
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: ['customer_id__customer_third_hop_id', 'customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ subq_15.customer_id__customer_third_hop_id
+ , subq_15.customer_id__customer_third_hop_id__paraguayan_customers
+ FROM (
+ -- Compute Metrics via Expressions
+ SELECT
+ subq_14.customer_id__customer_third_hop_id
+ , subq_14.customers_with_other_data AS customer_id__customer_third_hop_id__paraguayan_customers
+ FROM (
+ -- Aggregate Measures
+ SELECT
+ subq_13.customer_id__customer_third_hop_id
+ , SUM(subq_13.customers_with_other_data) AS customers_with_other_data
+ FROM (
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__customer_third_hop_id']
+ SELECT
+ subq_12.customer_id__customer_third_hop_id
+ , subq_12.customers_with_other_data
+ FROM (
+ -- Constrain Output with WHERE
+ SELECT
+ subq_11.customer_id__customer_third_hop_id
+ , subq_11.customer_id__country
+ , subq_11.customers_with_other_data
+ FROM (
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id']
+ SELECT
+ subq_10.customer_id__customer_third_hop_id
+ , subq_10.customer_id__country
+ , subq_10.customers_with_other_data
+ FROM (
+ -- Metric Time Dimension 'acquired_ds'
+ SELECT
+ subq_9.acquired_ds__day
+ , subq_9.acquired_ds__week
+ , subq_9.acquired_ds__month
+ , subq_9.acquired_ds__quarter
+ , subq_9.acquired_ds__year
+ , subq_9.acquired_ds__extract_year
+ , subq_9.acquired_ds__extract_quarter
+ , subq_9.acquired_ds__extract_month
+ , subq_9.acquired_ds__extract_day
+ , subq_9.acquired_ds__extract_dow
+ , subq_9.acquired_ds__extract_doy
+ , subq_9.customer_id__acquired_ds__day
+ , subq_9.customer_id__acquired_ds__week
+ , subq_9.customer_id__acquired_ds__month
+ , subq_9.customer_id__acquired_ds__quarter
+ , subq_9.customer_id__acquired_ds__year
+ , subq_9.customer_id__acquired_ds__extract_year
+ , subq_9.customer_id__acquired_ds__extract_quarter
+ , subq_9.customer_id__acquired_ds__extract_month
+ , subq_9.customer_id__acquired_ds__extract_day
+ , subq_9.customer_id__acquired_ds__extract_dow
+ , subq_9.customer_id__acquired_ds__extract_doy
+ , subq_9.customer_third_hop_id__acquired_ds__day
+ , subq_9.customer_third_hop_id__acquired_ds__week
+ , subq_9.customer_third_hop_id__acquired_ds__month
+ , subq_9.customer_third_hop_id__acquired_ds__quarter
+ , subq_9.customer_third_hop_id__acquired_ds__year
+ , subq_9.customer_third_hop_id__acquired_ds__extract_year
+ , subq_9.customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_9.customer_third_hop_id__acquired_ds__extract_month
+ , subq_9.customer_third_hop_id__acquired_ds__extract_day
+ , subq_9.customer_third_hop_id__acquired_ds__extract_dow
+ , subq_9.customer_third_hop_id__acquired_ds__extract_doy
+ , subq_9.acquired_ds__day AS metric_time__day
+ , subq_9.acquired_ds__week AS metric_time__week
+ , subq_9.acquired_ds__month AS metric_time__month
+ , subq_9.acquired_ds__quarter AS metric_time__quarter
+ , subq_9.acquired_ds__year AS metric_time__year
+ , subq_9.acquired_ds__extract_year AS metric_time__extract_year
+ , subq_9.acquired_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.acquired_ds__extract_month AS metric_time__extract_month
+ , subq_9.acquired_ds__extract_day AS metric_time__extract_day
+ , subq_9.acquired_ds__extract_dow AS metric_time__extract_dow
+ , subq_9.acquired_ds__extract_doy AS metric_time__extract_doy
+ , subq_9.customer_id
+ , subq_9.customer_third_hop_id
+ , subq_9.customer_id__customer_third_hop_id
+ , subq_9.customer_third_hop_id__customer_id
+ , subq_9.country
+ , subq_9.customer_id__country
+ , subq_9.customer_third_hop_id__country
+ , subq_9.customers_with_other_data
+ FROM (
+ -- Read Elements From Semantic Model 'customer_other_data'
+ SELECT
+ 1 AS customers_with_other_data
+ , customer_other_data_src_22000.country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_day
+ , EXTRACT(dayofweekiso FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_day
+ , EXTRACT(dayofweekiso FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_third_hop_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_day
+ , EXTRACT(dayofweekiso FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.customer_id
+ , customer_other_data_src_22000.customer_third_hop_id
+ , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id
+ , customer_other_data_src_22000.customer_id AS customer_third_hop_id__customer_id
+ FROM ***************************.customer_other_data customer_other_data_src_22000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+ WHERE customer_id__country = 'paraguay'
+ ) subq_12
+ ) subq_13
+ GROUP BY
+ subq_13.customer_id__customer_third_hop_id
+ ) subq_14
+ ) subq_15
+ ) subq_16
+ ON
+ subq_8.customer_third_hop_id = subq_16.customer_id__customer_third_hop_id
+ ) subq_17
+ ) subq_18
+ WHERE customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers > 0
+ ) subq_19
+ ) subq_20
+) subq_21
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Snowflake/test_inner_query_single_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Snowflake/test_inner_query_single_hop__plan0_optimized.sql
new file mode 100644
index 0000000000..2ad52ec04c
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Snowflake/test_inner_query_single_hop__plan0_optimized.sql
@@ -0,0 +1,40 @@
+-- Constrain Output with WHERE
+-- Pass Only Elements: ['third_hop_count',]
+-- Aggregate Measures
+-- Compute Metrics via Expressions
+SELECT
+ COUNT(DISTINCT third_hop_count) AS third_hop_count
+FROM (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ subq_32.customer_id__customer_third_hop_id__paraguayan_customers AS customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ LEFT OUTER JOIN (
+ -- Constrain Output with WHERE
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__customer_third_hop_id']
+ -- Aggregate Measures
+ -- Compute Metrics via Expressions
+ -- Pass Only Elements: ['customer_id__customer_third_hop_id', 'customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ customer_id__customer_third_hop_id
+ , SUM(customers_with_other_data) AS customer_id__customer_third_hop_id__paraguayan_customers
+ FROM (
+ -- Read Elements From Semantic Model 'customer_other_data'
+ -- Metric Time Dimension 'acquired_ds'
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id']
+ SELECT
+ customer_third_hop_id AS customer_id__customer_third_hop_id
+ , country AS customer_id__country
+ , 1 AS customers_with_other_data
+ FROM ***************************.customer_other_data customer_other_data_src_22000
+ ) subq_27
+ WHERE customer_id__country = 'paraguay'
+ GROUP BY
+ customer_id__customer_third_hop_id
+ ) subq_32
+ ON
+ third_hop_table_src_22000.customer_third_hop_id = subq_32.customer_id__customer_third_hop_id
+) subq_34
+WHERE customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers > 0
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Trino/test_inner_query_multi_hop__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Trino/test_inner_query_multi_hop__plan0.sql
new file mode 100644
index 0000000000..821ca74e2c
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Trino/test_inner_query_multi_hop__plan0.sql
@@ -0,0 +1,694 @@
+-- Compute Metrics via Expressions
+SELECT
+ subq_40.third_hop_count
+FROM (
+ -- Aggregate Measures
+ SELECT
+ COUNT(DISTINCT subq_39.third_hop_count) AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count',]
+ SELECT
+ subq_38.third_hop_count
+ FROM (
+ -- Constrain Output with WHERE
+ SELECT
+ subq_37.customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , subq_37.third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_36.customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , subq_36.third_hop_count
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_20.customer_third_hop_id AS customer_third_hop_id
+ , subq_35.account_id__customer_id__customer_third_hop_id AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id
+ , subq_35.account_id__customer_id__customer_third_hop_id__txn_count AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , subq_20.third_hop_count AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id']
+ SELECT
+ subq_19.customer_third_hop_id
+ , subq_19.third_hop_count
+ FROM (
+ -- Metric Time Dimension 'third_hop_ds'
+ SELECT
+ subq_18.third_hop_ds__day
+ , subq_18.third_hop_ds__week
+ , subq_18.third_hop_ds__month
+ , subq_18.third_hop_ds__quarter
+ , subq_18.third_hop_ds__year
+ , subq_18.third_hop_ds__extract_year
+ , subq_18.third_hop_ds__extract_quarter
+ , subq_18.third_hop_ds__extract_month
+ , subq_18.third_hop_ds__extract_day
+ , subq_18.third_hop_ds__extract_dow
+ , subq_18.third_hop_ds__extract_doy
+ , subq_18.customer_third_hop_id__third_hop_ds__day
+ , subq_18.customer_third_hop_id__third_hop_ds__week
+ , subq_18.customer_third_hop_id__third_hop_ds__month
+ , subq_18.customer_third_hop_id__third_hop_ds__quarter
+ , subq_18.customer_third_hop_id__third_hop_ds__year
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_year
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_quarter
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_month
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_day
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_dow
+ , subq_18.customer_third_hop_id__third_hop_ds__extract_doy
+ , subq_18.third_hop_ds__day AS metric_time__day
+ , subq_18.third_hop_ds__week AS metric_time__week
+ , subq_18.third_hop_ds__month AS metric_time__month
+ , subq_18.third_hop_ds__quarter AS metric_time__quarter
+ , subq_18.third_hop_ds__year AS metric_time__year
+ , subq_18.third_hop_ds__extract_year AS metric_time__extract_year
+ , subq_18.third_hop_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_18.third_hop_ds__extract_month AS metric_time__extract_month
+ , subq_18.third_hop_ds__extract_day AS metric_time__extract_day
+ , subq_18.third_hop_ds__extract_dow AS metric_time__extract_dow
+ , subq_18.third_hop_ds__extract_doy AS metric_time__extract_doy
+ , subq_18.customer_third_hop_id
+ , subq_18.value
+ , subq_18.customer_third_hop_id__value
+ , subq_18.third_hop_count
+ FROM (
+ -- Read Elements From Semantic Model 'third_hop_table'
+ SELECT
+ third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ , third_hop_table_src_22000.value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_doy
+ , third_hop_table_src_22000.value AS customer_third_hop_id__value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_doy
+ , third_hop_table_src_22000.customer_third_hop_id
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ ) subq_18
+ ) subq_19
+ ) subq_20
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: ['account_id__customer_id__customer_third_hop_id', 'account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_34.account_id__customer_id__customer_third_hop_id
+ , subq_34.account_id__customer_id__customer_third_hop_id__txn_count
+ FROM (
+ -- Compute Metrics via Expressions
+ SELECT
+ subq_33.account_id__customer_id__customer_third_hop_id
+ , subq_33.txn_count AS account_id__customer_id__customer_third_hop_id__txn_count
+ FROM (
+ -- Aggregate Measures
+ SELECT
+ subq_32.account_id__customer_id__customer_third_hop_id
+ , SUM(subq_32.txn_count) AS txn_count
+ FROM (
+ -- Pass Only Elements: ['txn_count', 'account_id__customer_id__customer_third_hop_id']
+ SELECT
+ subq_31.account_id__customer_id__customer_third_hop_id
+ , subq_31.txn_count
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_23.ds_partitioned__day AS ds_partitioned__day
+ , subq_30.ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_23.account_id AS account_id
+ , subq_30.customer_id__customer_third_hop_id AS account_id__customer_id__customer_third_hop_id
+ , subq_23.txn_count AS txn_count
+ FROM (
+ -- Pass Only Elements: ['txn_count', 'ds_partitioned__day', 'account_id']
+ SELECT
+ subq_22.ds_partitioned__day
+ , subq_22.account_id
+ , subq_22.txn_count
+ FROM (
+ -- Metric Time Dimension 'ds'
+ SELECT
+ subq_21.ds_partitioned__day
+ , subq_21.ds_partitioned__week
+ , subq_21.ds_partitioned__month
+ , subq_21.ds_partitioned__quarter
+ , subq_21.ds_partitioned__year
+ , subq_21.ds_partitioned__extract_year
+ , subq_21.ds_partitioned__extract_quarter
+ , subq_21.ds_partitioned__extract_month
+ , subq_21.ds_partitioned__extract_day
+ , subq_21.ds_partitioned__extract_dow
+ , subq_21.ds_partitioned__extract_doy
+ , subq_21.ds__day
+ , subq_21.ds__week
+ , subq_21.ds__month
+ , subq_21.ds__quarter
+ , subq_21.ds__year
+ , subq_21.ds__extract_year
+ , subq_21.ds__extract_quarter
+ , subq_21.ds__extract_month
+ , subq_21.ds__extract_day
+ , subq_21.ds__extract_dow
+ , subq_21.ds__extract_doy
+ , subq_21.account_id__ds_partitioned__day
+ , subq_21.account_id__ds_partitioned__week
+ , subq_21.account_id__ds_partitioned__month
+ , subq_21.account_id__ds_partitioned__quarter
+ , subq_21.account_id__ds_partitioned__year
+ , subq_21.account_id__ds_partitioned__extract_year
+ , subq_21.account_id__ds_partitioned__extract_quarter
+ , subq_21.account_id__ds_partitioned__extract_month
+ , subq_21.account_id__ds_partitioned__extract_day
+ , subq_21.account_id__ds_partitioned__extract_dow
+ , subq_21.account_id__ds_partitioned__extract_doy
+ , subq_21.account_id__ds__day
+ , subq_21.account_id__ds__week
+ , subq_21.account_id__ds__month
+ , subq_21.account_id__ds__quarter
+ , subq_21.account_id__ds__year
+ , subq_21.account_id__ds__extract_year
+ , subq_21.account_id__ds__extract_quarter
+ , subq_21.account_id__ds__extract_month
+ , subq_21.account_id__ds__extract_day
+ , subq_21.account_id__ds__extract_dow
+ , subq_21.account_id__ds__extract_doy
+ , subq_21.ds__day AS metric_time__day
+ , subq_21.ds__week AS metric_time__week
+ , subq_21.ds__month AS metric_time__month
+ , subq_21.ds__quarter AS metric_time__quarter
+ , subq_21.ds__year AS metric_time__year
+ , subq_21.ds__extract_year AS metric_time__extract_year
+ , subq_21.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_21.ds__extract_month AS metric_time__extract_month
+ , subq_21.ds__extract_day AS metric_time__extract_day
+ , subq_21.ds__extract_dow AS metric_time__extract_dow
+ , subq_21.ds__extract_doy AS metric_time__extract_doy
+ , subq_21.account_id
+ , subq_21.account_month
+ , subq_21.account_id__account_month
+ , subq_21.txn_count
+ FROM (
+ -- Read Elements From Semantic Model 'account_month_txns'
+ SELECT
+ account_month_txns_src_22000.txn_count
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS ds__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS ds__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS ds__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS ds__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS ds__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds) AS ds__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS ds__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds) AS ds__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds) AS ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM account_month_txns_src_22000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS ds__extract_doy
+ , account_month_txns_src_22000.account_month
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', account_month_txns_src_22000.ds) AS account_id__ds__day
+ , DATE_TRUNC('week', account_month_txns_src_22000.ds) AS account_id__ds__week
+ , DATE_TRUNC('month', account_month_txns_src_22000.ds) AS account_id__ds__month
+ , DATE_TRUNC('quarter', account_month_txns_src_22000.ds) AS account_id__ds__quarter
+ , DATE_TRUNC('year', account_month_txns_src_22000.ds) AS account_id__ds__year
+ , EXTRACT(year FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_year
+ , EXTRACT(quarter FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_quarter
+ , EXTRACT(month FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_month
+ , EXTRACT(day FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_dow
+ , EXTRACT(doy FROM account_month_txns_src_22000.ds) AS account_id__ds__extract_doy
+ , account_month_txns_src_22000.account_month AS account_id__account_month
+ , account_month_txns_src_22000.account_id
+ FROM ***************************.account_month_txns account_month_txns_src_22000
+ ) subq_21
+ ) subq_22
+ ) subq_23
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: ['ds_partitioned__day', 'account_id', 'customer_id__customer_third_hop_id']
+ SELECT
+ subq_29.ds_partitioned__day
+ , subq_29.account_id
+ , subq_29.customer_id__customer_third_hop_id
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_25.ds_partitioned__day AS ds_partitioned__day
+ , subq_25.ds_partitioned__week AS ds_partitioned__week
+ , subq_25.ds_partitioned__month AS ds_partitioned__month
+ , subq_25.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_25.ds_partitioned__year AS ds_partitioned__year
+ , subq_25.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_25.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_25.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_25.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_25.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_25.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_25.account_id__ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_25.account_id__ds_partitioned__week AS account_id__ds_partitioned__week
+ , subq_25.account_id__ds_partitioned__month AS account_id__ds_partitioned__month
+ , subq_25.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter
+ , subq_25.account_id__ds_partitioned__year AS account_id__ds_partitioned__year
+ , subq_25.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year
+ , subq_25.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter
+ , subq_25.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month
+ , subq_25.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day
+ , subq_25.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow
+ , subq_25.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy
+ , subq_25.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day
+ , subq_25.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week
+ , subq_25.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month
+ , subq_25.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter
+ , subq_25.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year
+ , subq_25.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year
+ , subq_25.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter
+ , subq_25.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month
+ , subq_25.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day
+ , subq_25.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow
+ , subq_25.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy
+ , subq_25.metric_time__day AS metric_time__day
+ , subq_25.metric_time__week AS metric_time__week
+ , subq_25.metric_time__month AS metric_time__month
+ , subq_25.metric_time__quarter AS metric_time__quarter
+ , subq_25.metric_time__year AS metric_time__year
+ , subq_25.metric_time__extract_year AS metric_time__extract_year
+ , subq_25.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_25.metric_time__extract_month AS metric_time__extract_month
+ , subq_25.metric_time__extract_day AS metric_time__extract_day
+ , subq_25.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_25.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_28.acquired_ds__day AS customer_id__acquired_ds__day
+ , subq_28.acquired_ds__week AS customer_id__acquired_ds__week
+ , subq_28.acquired_ds__month AS customer_id__acquired_ds__month
+ , subq_28.acquired_ds__quarter AS customer_id__acquired_ds__quarter
+ , subq_28.acquired_ds__year AS customer_id__acquired_ds__year
+ , subq_28.acquired_ds__extract_year AS customer_id__acquired_ds__extract_year
+ , subq_28.acquired_ds__extract_quarter AS customer_id__acquired_ds__extract_quarter
+ , subq_28.acquired_ds__extract_month AS customer_id__acquired_ds__extract_month
+ , subq_28.acquired_ds__extract_day AS customer_id__acquired_ds__extract_day
+ , subq_28.acquired_ds__extract_dow AS customer_id__acquired_ds__extract_dow
+ , subq_28.acquired_ds__extract_doy AS customer_id__acquired_ds__extract_doy
+ , subq_28.customer_third_hop_id__acquired_ds__day AS customer_id__customer_third_hop_id__acquired_ds__day
+ , subq_28.customer_third_hop_id__acquired_ds__week AS customer_id__customer_third_hop_id__acquired_ds__week
+ , subq_28.customer_third_hop_id__acquired_ds__month AS customer_id__customer_third_hop_id__acquired_ds__month
+ , subq_28.customer_third_hop_id__acquired_ds__quarter AS customer_id__customer_third_hop_id__acquired_ds__quarter
+ , subq_28.customer_third_hop_id__acquired_ds__year AS customer_id__customer_third_hop_id__acquired_ds__year
+ , subq_28.customer_third_hop_id__acquired_ds__extract_year AS customer_id__customer_third_hop_id__acquired_ds__extract_year
+ , subq_28.customer_third_hop_id__acquired_ds__extract_quarter AS customer_id__customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_28.customer_third_hop_id__acquired_ds__extract_month AS customer_id__customer_third_hop_id__acquired_ds__extract_month
+ , subq_28.customer_third_hop_id__acquired_ds__extract_day AS customer_id__customer_third_hop_id__acquired_ds__extract_day
+ , subq_28.customer_third_hop_id__acquired_ds__extract_dow AS customer_id__customer_third_hop_id__acquired_ds__extract_dow
+ , subq_28.customer_third_hop_id__acquired_ds__extract_doy AS customer_id__customer_third_hop_id__acquired_ds__extract_doy
+ , subq_28.metric_time__day AS customer_id__metric_time__day
+ , subq_28.metric_time__week AS customer_id__metric_time__week
+ , subq_28.metric_time__month AS customer_id__metric_time__month
+ , subq_28.metric_time__quarter AS customer_id__metric_time__quarter
+ , subq_28.metric_time__year AS customer_id__metric_time__year
+ , subq_28.metric_time__extract_year AS customer_id__metric_time__extract_year
+ , subq_28.metric_time__extract_quarter AS customer_id__metric_time__extract_quarter
+ , subq_28.metric_time__extract_month AS customer_id__metric_time__extract_month
+ , subq_28.metric_time__extract_day AS customer_id__metric_time__extract_day
+ , subq_28.metric_time__extract_dow AS customer_id__metric_time__extract_dow
+ , subq_28.metric_time__extract_doy AS customer_id__metric_time__extract_doy
+ , subq_25.account_id AS account_id
+ , subq_25.customer_id AS customer_id
+ , subq_25.account_id__customer_id AS account_id__customer_id
+ , subq_25.bridge_account__account_id AS bridge_account__account_id
+ , subq_25.bridge_account__customer_id AS bridge_account__customer_id
+ , subq_28.customer_third_hop_id AS customer_id__customer_third_hop_id
+ , subq_28.customer_third_hop_id__customer_id AS customer_id__customer_third_hop_id__customer_id
+ , subq_25.extra_dim AS extra_dim
+ , subq_25.account_id__extra_dim AS account_id__extra_dim
+ , subq_25.bridge_account__extra_dim AS bridge_account__extra_dim
+ , subq_28.country AS customer_id__country
+ , subq_28.customer_third_hop_id__country AS customer_id__customer_third_hop_id__country
+ , subq_25.account_customer_combos AS account_customer_combos
+ FROM (
+ -- Metric Time Dimension 'ds_partitioned'
+ SELECT
+ subq_24.ds_partitioned__day
+ , subq_24.ds_partitioned__week
+ , subq_24.ds_partitioned__month
+ , subq_24.ds_partitioned__quarter
+ , subq_24.ds_partitioned__year
+ , subq_24.ds_partitioned__extract_year
+ , subq_24.ds_partitioned__extract_quarter
+ , subq_24.ds_partitioned__extract_month
+ , subq_24.ds_partitioned__extract_day
+ , subq_24.ds_partitioned__extract_dow
+ , subq_24.ds_partitioned__extract_doy
+ , subq_24.account_id__ds_partitioned__day
+ , subq_24.account_id__ds_partitioned__week
+ , subq_24.account_id__ds_partitioned__month
+ , subq_24.account_id__ds_partitioned__quarter
+ , subq_24.account_id__ds_partitioned__year
+ , subq_24.account_id__ds_partitioned__extract_year
+ , subq_24.account_id__ds_partitioned__extract_quarter
+ , subq_24.account_id__ds_partitioned__extract_month
+ , subq_24.account_id__ds_partitioned__extract_day
+ , subq_24.account_id__ds_partitioned__extract_dow
+ , subq_24.account_id__ds_partitioned__extract_doy
+ , subq_24.bridge_account__ds_partitioned__day
+ , subq_24.bridge_account__ds_partitioned__week
+ , subq_24.bridge_account__ds_partitioned__month
+ , subq_24.bridge_account__ds_partitioned__quarter
+ , subq_24.bridge_account__ds_partitioned__year
+ , subq_24.bridge_account__ds_partitioned__extract_year
+ , subq_24.bridge_account__ds_partitioned__extract_quarter
+ , subq_24.bridge_account__ds_partitioned__extract_month
+ , subq_24.bridge_account__ds_partitioned__extract_day
+ , subq_24.bridge_account__ds_partitioned__extract_dow
+ , subq_24.bridge_account__ds_partitioned__extract_doy
+ , subq_24.ds_partitioned__day AS metric_time__day
+ , subq_24.ds_partitioned__week AS metric_time__week
+ , subq_24.ds_partitioned__month AS metric_time__month
+ , subq_24.ds_partitioned__quarter AS metric_time__quarter
+ , subq_24.ds_partitioned__year AS metric_time__year
+ , subq_24.ds_partitioned__extract_year AS metric_time__extract_year
+ , subq_24.ds_partitioned__extract_quarter AS metric_time__extract_quarter
+ , subq_24.ds_partitioned__extract_month AS metric_time__extract_month
+ , subq_24.ds_partitioned__extract_day AS metric_time__extract_day
+ , subq_24.ds_partitioned__extract_dow AS metric_time__extract_dow
+ , subq_24.ds_partitioned__extract_doy AS metric_time__extract_doy
+ , subq_24.account_id
+ , subq_24.customer_id
+ , subq_24.account_id__customer_id
+ , subq_24.bridge_account__account_id
+ , subq_24.bridge_account__customer_id
+ , subq_24.extra_dim
+ , subq_24.account_id__extra_dim
+ , subq_24.bridge_account__extra_dim
+ , subq_24.account_customer_combos
+ FROM (
+ -- Read Elements From Semantic Model 'bridge_table'
+ SELECT
+ account_id || customer_id AS account_customer_combos
+ , bridge_table_src_22000.extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS account_id__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy
+ , bridge_table_src_22000.account_id
+ , bridge_table_src_22000.customer_id
+ , bridge_table_src_22000.customer_id AS account_id__customer_id
+ , bridge_table_src_22000.account_id AS bridge_account__account_id
+ , bridge_table_src_22000.customer_id AS bridge_account__customer_id
+ FROM ***************************.bridge_table bridge_table_src_22000
+ ) subq_24
+ ) subq_25
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: [
+ -- 'country',
+ -- 'customer_id__country',
+ -- 'customer_third_hop_id__country',
+ -- 'acquired_ds__day',
+ -- 'acquired_ds__week',
+ -- 'acquired_ds__month',
+ -- 'acquired_ds__quarter',
+ -- 'acquired_ds__year',
+ -- 'acquired_ds__extract_year',
+ -- 'acquired_ds__extract_quarter',
+ -- 'acquired_ds__extract_month',
+ -- 'acquired_ds__extract_day',
+ -- 'acquired_ds__extract_dow',
+ -- 'acquired_ds__extract_doy',
+ -- 'customer_id__acquired_ds__day',
+ -- 'customer_id__acquired_ds__week',
+ -- 'customer_id__acquired_ds__month',
+ -- 'customer_id__acquired_ds__quarter',
+ -- 'customer_id__acquired_ds__year',
+ -- 'customer_id__acquired_ds__extract_year',
+ -- 'customer_id__acquired_ds__extract_quarter',
+ -- 'customer_id__acquired_ds__extract_month',
+ -- 'customer_id__acquired_ds__extract_day',
+ -- 'customer_id__acquired_ds__extract_dow',
+ -- 'customer_id__acquired_ds__extract_doy',
+ -- 'customer_third_hop_id__acquired_ds__day',
+ -- 'customer_third_hop_id__acquired_ds__week',
+ -- 'customer_third_hop_id__acquired_ds__month',
+ -- 'customer_third_hop_id__acquired_ds__quarter',
+ -- 'customer_third_hop_id__acquired_ds__year',
+ -- 'customer_third_hop_id__acquired_ds__extract_year',
+ -- 'customer_third_hop_id__acquired_ds__extract_quarter',
+ -- 'customer_third_hop_id__acquired_ds__extract_month',
+ -- 'customer_third_hop_id__acquired_ds__extract_day',
+ -- 'customer_third_hop_id__acquired_ds__extract_dow',
+ -- 'customer_third_hop_id__acquired_ds__extract_doy',
+ -- 'metric_time__day',
+ -- 'metric_time__week',
+ -- 'metric_time__month',
+ -- 'metric_time__quarter',
+ -- 'metric_time__year',
+ -- 'metric_time__extract_year',
+ -- 'metric_time__extract_quarter',
+ -- 'metric_time__extract_month',
+ -- 'metric_time__extract_day',
+ -- 'metric_time__extract_dow',
+ -- 'metric_time__extract_doy',
+ -- 'customer_id',
+ -- 'customer_third_hop_id',
+ -- 'customer_id__customer_third_hop_id',
+ -- 'customer_third_hop_id__customer_id',
+ -- ]
+ SELECT
+ subq_27.acquired_ds__day
+ , subq_27.acquired_ds__week
+ , subq_27.acquired_ds__month
+ , subq_27.acquired_ds__quarter
+ , subq_27.acquired_ds__year
+ , subq_27.acquired_ds__extract_year
+ , subq_27.acquired_ds__extract_quarter
+ , subq_27.acquired_ds__extract_month
+ , subq_27.acquired_ds__extract_day
+ , subq_27.acquired_ds__extract_dow
+ , subq_27.acquired_ds__extract_doy
+ , subq_27.customer_id__acquired_ds__day
+ , subq_27.customer_id__acquired_ds__week
+ , subq_27.customer_id__acquired_ds__month
+ , subq_27.customer_id__acquired_ds__quarter
+ , subq_27.customer_id__acquired_ds__year
+ , subq_27.customer_id__acquired_ds__extract_year
+ , subq_27.customer_id__acquired_ds__extract_quarter
+ , subq_27.customer_id__acquired_ds__extract_month
+ , subq_27.customer_id__acquired_ds__extract_day
+ , subq_27.customer_id__acquired_ds__extract_dow
+ , subq_27.customer_id__acquired_ds__extract_doy
+ , subq_27.customer_third_hop_id__acquired_ds__day
+ , subq_27.customer_third_hop_id__acquired_ds__week
+ , subq_27.customer_third_hop_id__acquired_ds__month
+ , subq_27.customer_third_hop_id__acquired_ds__quarter
+ , subq_27.customer_third_hop_id__acquired_ds__year
+ , subq_27.customer_third_hop_id__acquired_ds__extract_year
+ , subq_27.customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_27.customer_third_hop_id__acquired_ds__extract_month
+ , subq_27.customer_third_hop_id__acquired_ds__extract_day
+ , subq_27.customer_third_hop_id__acquired_ds__extract_dow
+ , subq_27.customer_third_hop_id__acquired_ds__extract_doy
+ , subq_27.metric_time__day
+ , subq_27.metric_time__week
+ , subq_27.metric_time__month
+ , subq_27.metric_time__quarter
+ , subq_27.metric_time__year
+ , subq_27.metric_time__extract_year
+ , subq_27.metric_time__extract_quarter
+ , subq_27.metric_time__extract_month
+ , subq_27.metric_time__extract_day
+ , subq_27.metric_time__extract_dow
+ , subq_27.metric_time__extract_doy
+ , subq_27.customer_id
+ , subq_27.customer_third_hop_id
+ , subq_27.customer_id__customer_third_hop_id
+ , subq_27.customer_third_hop_id__customer_id
+ , subq_27.country
+ , subq_27.customer_id__country
+ , subq_27.customer_third_hop_id__country
+ FROM (
+ -- Metric Time Dimension 'acquired_ds'
+ SELECT
+ subq_26.acquired_ds__day
+ , subq_26.acquired_ds__week
+ , subq_26.acquired_ds__month
+ , subq_26.acquired_ds__quarter
+ , subq_26.acquired_ds__year
+ , subq_26.acquired_ds__extract_year
+ , subq_26.acquired_ds__extract_quarter
+ , subq_26.acquired_ds__extract_month
+ , subq_26.acquired_ds__extract_day
+ , subq_26.acquired_ds__extract_dow
+ , subq_26.acquired_ds__extract_doy
+ , subq_26.customer_id__acquired_ds__day
+ , subq_26.customer_id__acquired_ds__week
+ , subq_26.customer_id__acquired_ds__month
+ , subq_26.customer_id__acquired_ds__quarter
+ , subq_26.customer_id__acquired_ds__year
+ , subq_26.customer_id__acquired_ds__extract_year
+ , subq_26.customer_id__acquired_ds__extract_quarter
+ , subq_26.customer_id__acquired_ds__extract_month
+ , subq_26.customer_id__acquired_ds__extract_day
+ , subq_26.customer_id__acquired_ds__extract_dow
+ , subq_26.customer_id__acquired_ds__extract_doy
+ , subq_26.customer_third_hop_id__acquired_ds__day
+ , subq_26.customer_third_hop_id__acquired_ds__week
+ , subq_26.customer_third_hop_id__acquired_ds__month
+ , subq_26.customer_third_hop_id__acquired_ds__quarter
+ , subq_26.customer_third_hop_id__acquired_ds__year
+ , subq_26.customer_third_hop_id__acquired_ds__extract_year
+ , subq_26.customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_26.customer_third_hop_id__acquired_ds__extract_month
+ , subq_26.customer_third_hop_id__acquired_ds__extract_day
+ , subq_26.customer_third_hop_id__acquired_ds__extract_dow
+ , subq_26.customer_third_hop_id__acquired_ds__extract_doy
+ , subq_26.acquired_ds__day AS metric_time__day
+ , subq_26.acquired_ds__week AS metric_time__week
+ , subq_26.acquired_ds__month AS metric_time__month
+ , subq_26.acquired_ds__quarter AS metric_time__quarter
+ , subq_26.acquired_ds__year AS metric_time__year
+ , subq_26.acquired_ds__extract_year AS metric_time__extract_year
+ , subq_26.acquired_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_26.acquired_ds__extract_month AS metric_time__extract_month
+ , subq_26.acquired_ds__extract_day AS metric_time__extract_day
+ , subq_26.acquired_ds__extract_dow AS metric_time__extract_dow
+ , subq_26.acquired_ds__extract_doy AS metric_time__extract_doy
+ , subq_26.customer_id
+ , subq_26.customer_third_hop_id
+ , subq_26.customer_id__customer_third_hop_id
+ , subq_26.customer_third_hop_id__customer_id
+ , subq_26.country
+ , subq_26.customer_id__country
+ , subq_26.customer_third_hop_id__country
+ , subq_26.customers_with_other_data
+ FROM (
+ -- Read Elements From Semantic Model 'customer_other_data'
+ SELECT
+ 1 AS customers_with_other_data
+ , customer_other_data_src_22000.country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_third_hop_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.customer_id
+ , customer_other_data_src_22000.customer_third_hop_id
+ , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id
+ , customer_other_data_src_22000.customer_id AS customer_third_hop_id__customer_id
+ FROM ***************************.customer_other_data customer_other_data_src_22000
+ ) subq_26
+ ) subq_27
+ ) subq_28
+ ON
+ subq_25.customer_id = subq_28.customer_id
+ ) subq_29
+ ) subq_30
+ ON
+ (
+ subq_23.account_id = subq_30.account_id
+ ) AND (
+ subq_23.ds_partitioned__day = subq_30.ds_partitioned__day
+ )
+ ) subq_31
+ ) subq_32
+ GROUP BY
+ subq_32.account_id__customer_id__customer_third_hop_id
+ ) subq_33
+ ) subq_34
+ ) subq_35
+ ON
+ subq_20.customer_third_hop_id = subq_35.account_id__customer_id__customer_third_hop_id
+ ) subq_36
+ ) subq_37
+ WHERE customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count > 2
+ ) subq_38
+ ) subq_39
+) subq_40
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Trino/test_inner_query_multi_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Trino/test_inner_query_multi_hop__plan0_optimized.sql
new file mode 100644
index 0000000000..d195b8867f
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Trino/test_inner_query_multi_hop__plan0_optimized.sql
@@ -0,0 +1,49 @@
+-- Constrain Output with WHERE
+-- Pass Only Elements: ['third_hop_count',]
+-- Aggregate Measures
+-- Compute Metrics via Expressions
+SELECT
+ COUNT(DISTINCT third_hop_count) AS third_hop_count
+FROM (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_58.account_id__customer_id__customer_third_hop_id__txn_count AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count
+ , third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ LEFT OUTER JOIN (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['txn_count', 'account_id__customer_id__customer_third_hop_id']
+ -- Aggregate Measures
+ -- Compute Metrics via Expressions
+ -- Pass Only Elements: ['account_id__customer_id__customer_third_hop_id', 'account_id__customer_id__customer_third_hop_id__txn_count']
+ SELECT
+ subq_53.customer_id__customer_third_hop_id AS account_id__customer_id__customer_third_hop_id
+ , SUM(account_month_txns_src_22000.txn_count) AS account_id__customer_id__customer_third_hop_id__txn_count
+ FROM ***************************.account_month_txns account_month_txns_src_22000
+ LEFT OUTER JOIN (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['ds_partitioned__day', 'account_id', 'customer_id__customer_third_hop_id']
+ SELECT
+ DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , bridge_table_src_22000.account_id AS account_id
+ , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id
+ FROM ***************************.bridge_table bridge_table_src_22000
+ LEFT OUTER JOIN
+ ***************************.customer_other_data customer_other_data_src_22000
+ ON
+ bridge_table_src_22000.customer_id = customer_other_data_src_22000.customer_id
+ ) subq_53
+ ON
+ (
+ account_month_txns_src_22000.account_id = subq_53.account_id
+ ) AND (
+ DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_53.ds_partitioned__day
+ )
+ GROUP BY
+ subq_53.customer_id__customer_third_hop_id
+ ) subq_58
+ ON
+ third_hop_table_src_22000.customer_third_hop_id = subq_58.account_id__customer_id__customer_third_hop_id
+) subq_60
+WHERE customer_third_hop_id__account_id__customer_id__customer_third_hop_id__txn_count > 2
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Trino/test_inner_query_single_hop__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Trino/test_inner_query_single_hop__plan0.sql
new file mode 100644
index 0000000000..12899f47dc
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Trino/test_inner_query_single_hop__plan0.sql
@@ -0,0 +1,257 @@
+-- Compute Metrics via Expressions
+SELECT
+ subq_21.third_hop_count
+FROM (
+ -- Aggregate Measures
+ SELECT
+ COUNT(DISTINCT subq_20.third_hop_count) AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count',]
+ SELECT
+ subq_19.third_hop_count
+ FROM (
+ -- Constrain Output with WHERE
+ SELECT
+ subq_18.customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , subq_18.third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ subq_17.customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , subq_17.third_hop_count
+ FROM (
+ -- Join Standard Outputs
+ SELECT
+ subq_8.customer_third_hop_id AS customer_third_hop_id
+ , subq_16.customer_id__customer_third_hop_id AS customer_third_hop_id__customer_id__customer_third_hop_id
+ , subq_16.customer_id__customer_third_hop_id__paraguayan_customers AS customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , subq_8.third_hop_count AS third_hop_count
+ FROM (
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id']
+ SELECT
+ subq_7.customer_third_hop_id
+ , subq_7.third_hop_count
+ FROM (
+ -- Metric Time Dimension 'third_hop_ds'
+ SELECT
+ subq_6.third_hop_ds__day
+ , subq_6.third_hop_ds__week
+ , subq_6.third_hop_ds__month
+ , subq_6.third_hop_ds__quarter
+ , subq_6.third_hop_ds__year
+ , subq_6.third_hop_ds__extract_year
+ , subq_6.third_hop_ds__extract_quarter
+ , subq_6.third_hop_ds__extract_month
+ , subq_6.third_hop_ds__extract_day
+ , subq_6.third_hop_ds__extract_dow
+ , subq_6.third_hop_ds__extract_doy
+ , subq_6.customer_third_hop_id__third_hop_ds__day
+ , subq_6.customer_third_hop_id__third_hop_ds__week
+ , subq_6.customer_third_hop_id__third_hop_ds__month
+ , subq_6.customer_third_hop_id__third_hop_ds__quarter
+ , subq_6.customer_third_hop_id__third_hop_ds__year
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_year
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_quarter
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_month
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_day
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_dow
+ , subq_6.customer_third_hop_id__third_hop_ds__extract_doy
+ , subq_6.third_hop_ds__day AS metric_time__day
+ , subq_6.third_hop_ds__week AS metric_time__week
+ , subq_6.third_hop_ds__month AS metric_time__month
+ , subq_6.third_hop_ds__quarter AS metric_time__quarter
+ , subq_6.third_hop_ds__year AS metric_time__year
+ , subq_6.third_hop_ds__extract_year AS metric_time__extract_year
+ , subq_6.third_hop_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_6.third_hop_ds__extract_month AS metric_time__extract_month
+ , subq_6.third_hop_ds__extract_day AS metric_time__extract_day
+ , subq_6.third_hop_ds__extract_dow AS metric_time__extract_dow
+ , subq_6.third_hop_ds__extract_doy AS metric_time__extract_doy
+ , subq_6.customer_third_hop_id
+ , subq_6.value
+ , subq_6.customer_third_hop_id__value
+ , subq_6.third_hop_count
+ FROM (
+ -- Read Elements From Semantic Model 'third_hop_table'
+ SELECT
+ third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ , third_hop_table_src_22000.value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS third_hop_ds__extract_doy
+ , third_hop_table_src_22000.value AS customer_third_hop_id__value
+ , DATE_TRUNC('day', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__day
+ , DATE_TRUNC('week', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__week
+ , DATE_TRUNC('month', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__month
+ , DATE_TRUNC('quarter', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__quarter
+ , DATE_TRUNC('year', third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__year
+ , EXTRACT(year FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_year
+ , EXTRACT(quarter FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_quarter
+ , EXTRACT(month FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_month
+ , EXTRACT(day FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_dow
+ , EXTRACT(doy FROM third_hop_table_src_22000.third_hop_ds) AS customer_third_hop_id__third_hop_ds__extract_doy
+ , third_hop_table_src_22000.customer_third_hop_id
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ ) subq_6
+ ) subq_7
+ ) subq_8
+ LEFT OUTER JOIN (
+ -- Pass Only Elements: ['customer_id__customer_third_hop_id', 'customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ subq_15.customer_id__customer_third_hop_id
+ , subq_15.customer_id__customer_third_hop_id__paraguayan_customers
+ FROM (
+ -- Compute Metrics via Expressions
+ SELECT
+ subq_14.customer_id__customer_third_hop_id
+ , subq_14.customers_with_other_data AS customer_id__customer_third_hop_id__paraguayan_customers
+ FROM (
+ -- Aggregate Measures
+ SELECT
+ subq_13.customer_id__customer_third_hop_id
+ , SUM(subq_13.customers_with_other_data) AS customers_with_other_data
+ FROM (
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__customer_third_hop_id']
+ SELECT
+ subq_12.customer_id__customer_third_hop_id
+ , subq_12.customers_with_other_data
+ FROM (
+ -- Constrain Output with WHERE
+ SELECT
+ subq_11.customer_id__customer_third_hop_id
+ , subq_11.customer_id__country
+ , subq_11.customers_with_other_data
+ FROM (
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id']
+ SELECT
+ subq_10.customer_id__customer_third_hop_id
+ , subq_10.customer_id__country
+ , subq_10.customers_with_other_data
+ FROM (
+ -- Metric Time Dimension 'acquired_ds'
+ SELECT
+ subq_9.acquired_ds__day
+ , subq_9.acquired_ds__week
+ , subq_9.acquired_ds__month
+ , subq_9.acquired_ds__quarter
+ , subq_9.acquired_ds__year
+ , subq_9.acquired_ds__extract_year
+ , subq_9.acquired_ds__extract_quarter
+ , subq_9.acquired_ds__extract_month
+ , subq_9.acquired_ds__extract_day
+ , subq_9.acquired_ds__extract_dow
+ , subq_9.acquired_ds__extract_doy
+ , subq_9.customer_id__acquired_ds__day
+ , subq_9.customer_id__acquired_ds__week
+ , subq_9.customer_id__acquired_ds__month
+ , subq_9.customer_id__acquired_ds__quarter
+ , subq_9.customer_id__acquired_ds__year
+ , subq_9.customer_id__acquired_ds__extract_year
+ , subq_9.customer_id__acquired_ds__extract_quarter
+ , subq_9.customer_id__acquired_ds__extract_month
+ , subq_9.customer_id__acquired_ds__extract_day
+ , subq_9.customer_id__acquired_ds__extract_dow
+ , subq_9.customer_id__acquired_ds__extract_doy
+ , subq_9.customer_third_hop_id__acquired_ds__day
+ , subq_9.customer_third_hop_id__acquired_ds__week
+ , subq_9.customer_third_hop_id__acquired_ds__month
+ , subq_9.customer_third_hop_id__acquired_ds__quarter
+ , subq_9.customer_third_hop_id__acquired_ds__year
+ , subq_9.customer_third_hop_id__acquired_ds__extract_year
+ , subq_9.customer_third_hop_id__acquired_ds__extract_quarter
+ , subq_9.customer_third_hop_id__acquired_ds__extract_month
+ , subq_9.customer_third_hop_id__acquired_ds__extract_day
+ , subq_9.customer_third_hop_id__acquired_ds__extract_dow
+ , subq_9.customer_third_hop_id__acquired_ds__extract_doy
+ , subq_9.acquired_ds__day AS metric_time__day
+ , subq_9.acquired_ds__week AS metric_time__week
+ , subq_9.acquired_ds__month AS metric_time__month
+ , subq_9.acquired_ds__quarter AS metric_time__quarter
+ , subq_9.acquired_ds__year AS metric_time__year
+ , subq_9.acquired_ds__extract_year AS metric_time__extract_year
+ , subq_9.acquired_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.acquired_ds__extract_month AS metric_time__extract_month
+ , subq_9.acquired_ds__extract_day AS metric_time__extract_day
+ , subq_9.acquired_ds__extract_dow AS metric_time__extract_dow
+ , subq_9.acquired_ds__extract_doy AS metric_time__extract_doy
+ , subq_9.customer_id
+ , subq_9.customer_third_hop_id
+ , subq_9.customer_id__customer_third_hop_id
+ , subq_9.customer_third_hop_id__customer_id
+ , subq_9.country
+ , subq_9.customer_id__country
+ , subq_9.customer_third_hop_id__country
+ , subq_9.customers_with_other_data
+ FROM (
+ -- Read Elements From Semantic Model 'customer_other_data'
+ SELECT
+ 1 AS customers_with_other_data
+ , customer_other_data_src_22000.country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.country AS customer_third_hop_id__country
+ , DATE_TRUNC('day', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__day
+ , DATE_TRUNC('week', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__week
+ , DATE_TRUNC('month', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__month
+ , DATE_TRUNC('quarter', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__quarter
+ , DATE_TRUNC('year', customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__year
+ , EXTRACT(year FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_year
+ , EXTRACT(quarter FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_quarter
+ , EXTRACT(month FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_month
+ , EXTRACT(day FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_dow
+ , EXTRACT(doy FROM customer_other_data_src_22000.acquired_ds) AS customer_third_hop_id__acquired_ds__extract_doy
+ , customer_other_data_src_22000.customer_id
+ , customer_other_data_src_22000.customer_third_hop_id
+ , customer_other_data_src_22000.customer_third_hop_id AS customer_id__customer_third_hop_id
+ , customer_other_data_src_22000.customer_id AS customer_third_hop_id__customer_id
+ FROM ***************************.customer_other_data customer_other_data_src_22000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+ WHERE customer_id__country = 'paraguay'
+ ) subq_12
+ ) subq_13
+ GROUP BY
+ subq_13.customer_id__customer_third_hop_id
+ ) subq_14
+ ) subq_15
+ ) subq_16
+ ON
+ subq_8.customer_third_hop_id = subq_16.customer_id__customer_third_hop_id
+ ) subq_17
+ ) subq_18
+ WHERE customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers > 0
+ ) subq_19
+ ) subq_20
+) subq_21
diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Trino/test_inner_query_single_hop__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Trino/test_inner_query_single_hop__plan0_optimized.sql
new file mode 100644
index 0000000000..2ad52ec04c
--- /dev/null
+++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/Trino/test_inner_query_single_hop__plan0_optimized.sql
@@ -0,0 +1,40 @@
+-- Constrain Output with WHERE
+-- Pass Only Elements: ['third_hop_count',]
+-- Aggregate Measures
+-- Compute Metrics via Expressions
+SELECT
+ COUNT(DISTINCT third_hop_count) AS third_hop_count
+FROM (
+ -- Join Standard Outputs
+ -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ subq_32.customer_id__customer_third_hop_id__paraguayan_customers AS customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers
+ , third_hop_table_src_22000.customer_third_hop_id AS third_hop_count
+ FROM ***************************.third_hop_table third_hop_table_src_22000
+ LEFT OUTER JOIN (
+ -- Constrain Output with WHERE
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__customer_third_hop_id']
+ -- Aggregate Measures
+ -- Compute Metrics via Expressions
+ -- Pass Only Elements: ['customer_id__customer_third_hop_id', 'customer_id__customer_third_hop_id__paraguayan_customers']
+ SELECT
+ customer_id__customer_third_hop_id
+ , SUM(customers_with_other_data) AS customer_id__customer_third_hop_id__paraguayan_customers
+ FROM (
+ -- Read Elements From Semantic Model 'customer_other_data'
+ -- Metric Time Dimension 'acquired_ds'
+ -- Pass Only Elements: ['customers_with_other_data', 'customer_id__country', 'customer_id__customer_third_hop_id']
+ SELECT
+ customer_third_hop_id AS customer_id__customer_third_hop_id
+ , country AS customer_id__country
+ , 1 AS customers_with_other_data
+ FROM ***************************.customer_other_data customer_other_data_src_22000
+ ) subq_27
+ WHERE customer_id__country = 'paraguay'
+ GROUP BY
+ customer_id__customer_third_hop_id
+ ) subq_32
+ ON
+ third_hop_table_src_22000.customer_third_hop_id = subq_32.customer_id__customer_third_hop_id
+) subq_34
+WHERE customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers > 0
diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql
index de6661cb11..7ba2ceaf5f 100644
--- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql
+++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0.sql
@@ -1,93 +1,93 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.account_id__customer_id__customer_name
- , subq_13.txn_count
+ subq_17.account_id__customer_id__customer_name
+ , subq_17.txn_count
FROM (
-- Aggregate Measures
SELECT
- subq_12.account_id__customer_id__customer_name
- , SUM(subq_12.txn_count) AS txn_count
+ subq_16.account_id__customer_id__customer_name
+ , SUM(subq_16.txn_count) AS txn_count
FROM (
-- Pass Only Elements: ['txn_count', 'account_id__customer_id__customer_name']
SELECT
- subq_11.account_id__customer_id__customer_name
- , subq_11.txn_count
+ subq_15.account_id__customer_id__customer_name
+ , subq_15.txn_count
FROM (
-- Join Standard Outputs
SELECT
- subq_5.ds_partitioned__day AS ds_partitioned__day
- , subq_10.ds_partitioned__day AS account_id__ds_partitioned__day
- , subq_5.account_id AS account_id
- , subq_10.customer_id__customer_name AS account_id__customer_id__customer_name
- , subq_5.txn_count AS txn_count
+ subq_7.ds_partitioned__day AS ds_partitioned__day
+ , subq_14.ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_7.account_id AS account_id
+ , subq_14.customer_id__customer_name AS account_id__customer_id__customer_name
+ , subq_7.txn_count AS txn_count
FROM (
-- Pass Only Elements: ['txn_count', 'ds_partitioned__day', 'account_id']
SELECT
- subq_4.ds_partitioned__day
- , subq_4.account_id
- , subq_4.txn_count
+ subq_6.ds_partitioned__day
+ , subq_6.account_id
+ , subq_6.txn_count
FROM (
-- Metric Time Dimension 'ds'
SELECT
- 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.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.account_id__ds_partitioned__day
- , subq_3.account_id__ds_partitioned__week
- , subq_3.account_id__ds_partitioned__month
- , subq_3.account_id__ds_partitioned__quarter
- , subq_3.account_id__ds_partitioned__year
- , subq_3.account_id__ds_partitioned__extract_year
- , subq_3.account_id__ds_partitioned__extract_quarter
- , subq_3.account_id__ds_partitioned__extract_month
- , subq_3.account_id__ds_partitioned__extract_day
- , subq_3.account_id__ds_partitioned__extract_dow
- , subq_3.account_id__ds_partitioned__extract_doy
- , subq_3.account_id__ds__day
- , subq_3.account_id__ds__week
- , subq_3.account_id__ds__month
- , subq_3.account_id__ds__quarter
- , subq_3.account_id__ds__year
- , subq_3.account_id__ds__extract_year
- , subq_3.account_id__ds__extract_quarter
- , subq_3.account_id__ds__extract_month
- , subq_3.account_id__ds__extract_day
- , subq_3.account_id__ds__extract_dow
- , subq_3.account_id__ds__extract_doy
- , subq_3.ds__day AS metric_time__day
- , subq_3.ds__week AS metric_time__week
- , subq_3.ds__month AS metric_time__month
- , subq_3.ds__quarter AS metric_time__quarter
- , subq_3.ds__year AS metric_time__year
- , subq_3.ds__extract_year AS metric_time__extract_year
- , subq_3.ds__extract_quarter AS metric_time__extract_quarter
- , subq_3.ds__extract_month AS metric_time__extract_month
- , subq_3.ds__extract_day AS metric_time__extract_day
- , subq_3.ds__extract_dow AS metric_time__extract_dow
- , subq_3.ds__extract_doy AS metric_time__extract_doy
- , subq_3.account_id
- , subq_3.account_month
- , subq_3.account_id__account_month
- , subq_3.txn_count
+ subq_5.ds_partitioned__day
+ , subq_5.ds_partitioned__week
+ , subq_5.ds_partitioned__month
+ , subq_5.ds_partitioned__quarter
+ , subq_5.ds_partitioned__year
+ , subq_5.ds_partitioned__extract_year
+ , subq_5.ds_partitioned__extract_quarter
+ , subq_5.ds_partitioned__extract_month
+ , subq_5.ds_partitioned__extract_day
+ , subq_5.ds_partitioned__extract_dow
+ , subq_5.ds_partitioned__extract_doy
+ , subq_5.ds__day
+ , subq_5.ds__week
+ , subq_5.ds__month
+ , subq_5.ds__quarter
+ , subq_5.ds__year
+ , subq_5.ds__extract_year
+ , subq_5.ds__extract_quarter
+ , subq_5.ds__extract_month
+ , subq_5.ds__extract_day
+ , subq_5.ds__extract_dow
+ , subq_5.ds__extract_doy
+ , subq_5.account_id__ds_partitioned__day
+ , subq_5.account_id__ds_partitioned__week
+ , subq_5.account_id__ds_partitioned__month
+ , subq_5.account_id__ds_partitioned__quarter
+ , subq_5.account_id__ds_partitioned__year
+ , subq_5.account_id__ds_partitioned__extract_year
+ , subq_5.account_id__ds_partitioned__extract_quarter
+ , subq_5.account_id__ds_partitioned__extract_month
+ , subq_5.account_id__ds_partitioned__extract_day
+ , subq_5.account_id__ds_partitioned__extract_dow
+ , subq_5.account_id__ds_partitioned__extract_doy
+ , subq_5.account_id__ds__day
+ , subq_5.account_id__ds__week
+ , subq_5.account_id__ds__month
+ , subq_5.account_id__ds__quarter
+ , subq_5.account_id__ds__year
+ , subq_5.account_id__ds__extract_year
+ , subq_5.account_id__ds__extract_quarter
+ , subq_5.account_id__ds__extract_month
+ , subq_5.account_id__ds__extract_day
+ , subq_5.account_id__ds__extract_dow
+ , subq_5.account_id__ds__extract_doy
+ , subq_5.ds__day AS metric_time__day
+ , subq_5.ds__week AS metric_time__week
+ , subq_5.ds__month AS metric_time__month
+ , subq_5.ds__quarter AS metric_time__quarter
+ , subq_5.ds__year AS metric_time__year
+ , subq_5.ds__extract_year AS metric_time__extract_year
+ , subq_5.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_5.ds__extract_month AS metric_time__extract_month
+ , subq_5.ds__extract_day AS metric_time__extract_day
+ , subq_5.ds__extract_dow AS metric_time__extract_dow
+ , subq_5.ds__extract_doy AS metric_time__extract_doy
+ , subq_5.account_id
+ , subq_5.account_month
+ , subq_5.account_id__account_month
+ , subq_5.txn_count
FROM (
-- Read Elements From Semantic Model 'account_month_txns'
SELECT
@@ -140,118 +140,199 @@ FROM (
, account_month_txns_src_22000.account_month AS account_id__account_month
, account_month_txns_src_22000.account_id
FROM ***************************.account_month_txns account_month_txns_src_22000
- ) subq_3
- ) subq_4
- ) subq_5
+ ) subq_5
+ ) subq_6
+ ) subq_7
LEFT OUTER JOIN (
-- Pass Only Elements: ['customer_id__customer_name', 'ds_partitioned__day', 'account_id']
SELECT
- subq_9.ds_partitioned__day
- , subq_9.account_id
- , subq_9.customer_id__customer_name
+ subq_13.ds_partitioned__day
+ , subq_13.account_id
+ , subq_13.customer_id__customer_name
FROM (
-- Join Standard Outputs
SELECT
- subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.account_id__ds_partitioned__day AS account_id__ds_partitioned__day
- , subq_6.account_id__ds_partitioned__week AS account_id__ds_partitioned__week
- , subq_6.account_id__ds_partitioned__month AS account_id__ds_partitioned__month
- , subq_6.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter
- , subq_6.account_id__ds_partitioned__year AS account_id__ds_partitioned__year
- , subq_6.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year
- , subq_6.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter
- , subq_6.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month
- , subq_6.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day
- , subq_6.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow
- , subq_6.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy
- , subq_6.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day
- , subq_6.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week
- , subq_6.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month
- , subq_6.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter
- , subq_6.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year
- , subq_6.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year
- , subq_6.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter
- , subq_6.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month
- , subq_6.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day
- , subq_6.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow
- , subq_6.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy
- , subq_8.ds_partitioned__day AS customer_id__ds_partitioned__day
- , subq_8.ds_partitioned__week AS customer_id__ds_partitioned__week
- , subq_8.ds_partitioned__month AS customer_id__ds_partitioned__month
- , subq_8.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter
- , subq_8.ds_partitioned__year AS customer_id__ds_partitioned__year
- , subq_8.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year
- , subq_8.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter
- , subq_8.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month
- , subq_8.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day
- , subq_8.ds_partitioned__extract_dow AS customer_id__ds_partitioned__extract_dow
- , subq_8.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy
- , subq_6.account_id AS account_id
- , subq_6.customer_id AS customer_id
- , subq_6.account_id__customer_id AS account_id__customer_id
- , subq_6.bridge_account__account_id AS bridge_account__account_id
- , subq_6.bridge_account__customer_id AS bridge_account__customer_id
- , subq_6.extra_dim AS extra_dim
- , subq_6.account_id__extra_dim AS account_id__extra_dim
- , subq_6.bridge_account__extra_dim AS bridge_account__extra_dim
- , subq_8.customer_name AS customer_id__customer_name
- , subq_8.customer_atomic_weight AS customer_id__customer_atomic_weight
+ subq_9.ds_partitioned__day AS ds_partitioned__day
+ , subq_9.ds_partitioned__week AS ds_partitioned__week
+ , subq_9.ds_partitioned__month AS ds_partitioned__month
+ , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_9.ds_partitioned__year AS ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_9.account_id__ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_9.account_id__ds_partitioned__week AS account_id__ds_partitioned__week
+ , subq_9.account_id__ds_partitioned__month AS account_id__ds_partitioned__month
+ , subq_9.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter
+ , subq_9.account_id__ds_partitioned__year AS account_id__ds_partitioned__year
+ , subq_9.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year
+ , subq_9.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter
+ , subq_9.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month
+ , subq_9.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day
+ , subq_9.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow
+ , subq_9.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy
+ , subq_9.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day
+ , subq_9.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week
+ , subq_9.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month
+ , subq_9.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter
+ , subq_9.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year
+ , subq_9.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year
+ , subq_9.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter
+ , subq_9.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month
+ , subq_9.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day
+ , subq_9.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow
+ , subq_9.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy
+ , subq_9.metric_time__day AS metric_time__day
+ , subq_9.metric_time__week AS metric_time__week
+ , subq_9.metric_time__month AS metric_time__month
+ , subq_9.metric_time__quarter AS metric_time__quarter
+ , subq_9.metric_time__year AS metric_time__year
+ , subq_9.metric_time__extract_year AS metric_time__extract_year
+ , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_9.metric_time__extract_month AS metric_time__extract_month
+ , subq_9.metric_time__extract_day AS metric_time__extract_day
+ , subq_9.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_9.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_12.ds_partitioned__day AS customer_id__ds_partitioned__day
+ , subq_12.ds_partitioned__week AS customer_id__ds_partitioned__week
+ , subq_12.ds_partitioned__month AS customer_id__ds_partitioned__month
+ , subq_12.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter
+ , subq_12.ds_partitioned__year AS customer_id__ds_partitioned__year
+ , subq_12.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year
+ , subq_12.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter
+ , subq_12.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month
+ , subq_12.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day
+ , subq_12.ds_partitioned__extract_dow AS customer_id__ds_partitioned__extract_dow
+ , subq_12.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy
+ , subq_12.metric_time__day AS customer_id__metric_time__day
+ , subq_12.metric_time__week AS customer_id__metric_time__week
+ , subq_12.metric_time__month AS customer_id__metric_time__month
+ , subq_12.metric_time__quarter AS customer_id__metric_time__quarter
+ , subq_12.metric_time__year AS customer_id__metric_time__year
+ , subq_12.metric_time__extract_year AS customer_id__metric_time__extract_year
+ , subq_12.metric_time__extract_quarter AS customer_id__metric_time__extract_quarter
+ , subq_12.metric_time__extract_month AS customer_id__metric_time__extract_month
+ , subq_12.metric_time__extract_day AS customer_id__metric_time__extract_day
+ , subq_12.metric_time__extract_dow AS customer_id__metric_time__extract_dow
+ , subq_12.metric_time__extract_doy AS customer_id__metric_time__extract_doy
+ , subq_9.account_id AS account_id
+ , subq_9.customer_id AS customer_id
+ , subq_9.account_id__customer_id AS account_id__customer_id
+ , subq_9.bridge_account__account_id AS bridge_account__account_id
+ , subq_9.bridge_account__customer_id AS bridge_account__customer_id
+ , subq_9.extra_dim AS extra_dim
+ , subq_9.account_id__extra_dim AS account_id__extra_dim
+ , subq_9.bridge_account__extra_dim AS bridge_account__extra_dim
+ , subq_12.customer_name AS customer_id__customer_name
+ , subq_12.customer_atomic_weight AS customer_id__customer_atomic_weight
+ , subq_9.account_customer_combos AS account_customer_combos
FROM (
- -- Read Elements From Semantic Model 'bridge_table'
+ -- Metric Time Dimension 'ds_partitioned'
SELECT
- bridge_table_src_22000.extra_dim
- , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
- , bridge_table_src_22000.extra_dim AS account_id__extra_dim
- , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS account_id__ds_partitioned__day
- , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, isoweek) AS account_id__ds_partitioned__week
- , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, month) AS account_id__ds_partitioned__month
- , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, quarter) AS account_id__ds_partitioned__quarter
- , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, year) AS account_id__ds_partitioned__year
- , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
- , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) - 1) AS account_id__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
- , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim
- , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS bridge_account__ds_partitioned__day
- , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, isoweek) AS bridge_account__ds_partitioned__week
- , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, month) AS bridge_account__ds_partitioned__month
- , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, quarter) AS bridge_account__ds_partitioned__quarter
- , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, year) AS bridge_account__ds_partitioned__year
- , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month
- , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) - 1) AS bridge_account__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy
- , bridge_table_src_22000.account_id
- , bridge_table_src_22000.customer_id
- , bridge_table_src_22000.customer_id AS account_id__customer_id
- , bridge_table_src_22000.account_id AS bridge_account__account_id
- , bridge_table_src_22000.customer_id AS bridge_account__customer_id
- FROM ***************************.bridge_table bridge_table_src_22000
- ) subq_6
+ subq_8.ds_partitioned__day
+ , subq_8.ds_partitioned__week
+ , subq_8.ds_partitioned__month
+ , subq_8.ds_partitioned__quarter
+ , subq_8.ds_partitioned__year
+ , subq_8.ds_partitioned__extract_year
+ , subq_8.ds_partitioned__extract_quarter
+ , subq_8.ds_partitioned__extract_month
+ , subq_8.ds_partitioned__extract_day
+ , subq_8.ds_partitioned__extract_dow
+ , subq_8.ds_partitioned__extract_doy
+ , subq_8.account_id__ds_partitioned__day
+ , subq_8.account_id__ds_partitioned__week
+ , subq_8.account_id__ds_partitioned__month
+ , subq_8.account_id__ds_partitioned__quarter
+ , subq_8.account_id__ds_partitioned__year
+ , subq_8.account_id__ds_partitioned__extract_year
+ , subq_8.account_id__ds_partitioned__extract_quarter
+ , subq_8.account_id__ds_partitioned__extract_month
+ , subq_8.account_id__ds_partitioned__extract_day
+ , subq_8.account_id__ds_partitioned__extract_dow
+ , subq_8.account_id__ds_partitioned__extract_doy
+ , subq_8.bridge_account__ds_partitioned__day
+ , subq_8.bridge_account__ds_partitioned__week
+ , subq_8.bridge_account__ds_partitioned__month
+ , subq_8.bridge_account__ds_partitioned__quarter
+ , subq_8.bridge_account__ds_partitioned__year
+ , subq_8.bridge_account__ds_partitioned__extract_year
+ , subq_8.bridge_account__ds_partitioned__extract_quarter
+ , subq_8.bridge_account__ds_partitioned__extract_month
+ , subq_8.bridge_account__ds_partitioned__extract_day
+ , subq_8.bridge_account__ds_partitioned__extract_dow
+ , subq_8.bridge_account__ds_partitioned__extract_doy
+ , subq_8.ds_partitioned__day AS metric_time__day
+ , subq_8.ds_partitioned__week AS metric_time__week
+ , subq_8.ds_partitioned__month AS metric_time__month
+ , subq_8.ds_partitioned__quarter AS metric_time__quarter
+ , subq_8.ds_partitioned__year AS metric_time__year
+ , subq_8.ds_partitioned__extract_year AS metric_time__extract_year
+ , subq_8.ds_partitioned__extract_quarter AS metric_time__extract_quarter
+ , subq_8.ds_partitioned__extract_month AS metric_time__extract_month
+ , subq_8.ds_partitioned__extract_day AS metric_time__extract_day
+ , subq_8.ds_partitioned__extract_dow AS metric_time__extract_dow
+ , subq_8.ds_partitioned__extract_doy AS metric_time__extract_doy
+ , subq_8.account_id
+ , subq_8.customer_id
+ , subq_8.account_id__customer_id
+ , subq_8.bridge_account__account_id
+ , subq_8.bridge_account__customer_id
+ , subq_8.extra_dim
+ , subq_8.account_id__extra_dim
+ , subq_8.bridge_account__extra_dim
+ , subq_8.account_customer_combos
+ FROM (
+ -- Read Elements From Semantic Model 'bridge_table'
+ SELECT
+ account_id || customer_id AS account_customer_combos
+ , bridge_table_src_22000.extra_dim
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS ds_partitioned__day
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, isoweek) AS ds_partitioned__week
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, month) AS ds_partitioned__month
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, quarter) AS ds_partitioned__quarter
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, year) AS ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , IF(EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) - 1) AS ds_partitioned__extract_dow
+ , EXTRACT(dayofyear FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS account_id__extra_dim
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS account_id__ds_partitioned__day
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, isoweek) AS account_id__ds_partitioned__week
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, month) AS account_id__ds_partitioned__month
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, quarter) AS account_id__ds_partitioned__quarter
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, year) AS account_id__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
+ , IF(EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) - 1) AS account_id__ds_partitioned__extract_dow
+ , EXTRACT(dayofyear FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, day) AS bridge_account__ds_partitioned__day
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, isoweek) AS bridge_account__ds_partitioned__week
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, month) AS bridge_account__ds_partitioned__month
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, quarter) AS bridge_account__ds_partitioned__quarter
+ , DATE_TRUNC(bridge_table_src_22000.ds_partitioned, year) AS bridge_account__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_day
+ , IF(EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bridge_table_src_22000.ds_partitioned) - 1) AS bridge_account__ds_partitioned__extract_dow
+ , EXTRACT(dayofyear FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy
+ , bridge_table_src_22000.account_id
+ , bridge_table_src_22000.customer_id
+ , bridge_table_src_22000.customer_id AS account_id__customer_id
+ , bridge_table_src_22000.account_id AS bridge_account__account_id
+ , bridge_table_src_22000.customer_id AS bridge_account__customer_id
+ FROM ***************************.bridge_table bridge_table_src_22000
+ ) subq_8
+ ) subq_9
LEFT OUTER JOIN (
-- Pass Only Elements: [
-- 'customer_name',
@@ -280,85 +361,151 @@ FROM (
-- 'customer_id__ds_partitioned__extract_day',
-- 'customer_id__ds_partitioned__extract_dow',
-- 'customer_id__ds_partitioned__extract_doy',
+ -- 'metric_time__day',
+ -- 'metric_time__week',
+ -- 'metric_time__month',
+ -- 'metric_time__quarter',
+ -- 'metric_time__year',
+ -- 'metric_time__extract_year',
+ -- 'metric_time__extract_quarter',
+ -- 'metric_time__extract_month',
+ -- 'metric_time__extract_day',
+ -- 'metric_time__extract_dow',
+ -- 'metric_time__extract_doy',
-- 'customer_id',
-- ]
SELECT
- subq_7.ds_partitioned__day
- , subq_7.ds_partitioned__week
- , subq_7.ds_partitioned__month
- , subq_7.ds_partitioned__quarter
- , subq_7.ds_partitioned__year
- , subq_7.ds_partitioned__extract_year
- , subq_7.ds_partitioned__extract_quarter
- , subq_7.ds_partitioned__extract_month
- , subq_7.ds_partitioned__extract_day
- , subq_7.ds_partitioned__extract_dow
- , subq_7.ds_partitioned__extract_doy
- , subq_7.customer_id__ds_partitioned__day
- , subq_7.customer_id__ds_partitioned__week
- , subq_7.customer_id__ds_partitioned__month
- , subq_7.customer_id__ds_partitioned__quarter
- , subq_7.customer_id__ds_partitioned__year
- , subq_7.customer_id__ds_partitioned__extract_year
- , subq_7.customer_id__ds_partitioned__extract_quarter
- , subq_7.customer_id__ds_partitioned__extract_month
- , subq_7.customer_id__ds_partitioned__extract_day
- , subq_7.customer_id__ds_partitioned__extract_dow
- , subq_7.customer_id__ds_partitioned__extract_doy
- , subq_7.customer_id
- , subq_7.customer_name
- , subq_7.customer_atomic_weight
- , subq_7.customer_id__customer_name
- , subq_7.customer_id__customer_atomic_weight
+ subq_11.ds_partitioned__day
+ , subq_11.ds_partitioned__week
+ , subq_11.ds_partitioned__month
+ , subq_11.ds_partitioned__quarter
+ , subq_11.ds_partitioned__year
+ , subq_11.ds_partitioned__extract_year
+ , subq_11.ds_partitioned__extract_quarter
+ , subq_11.ds_partitioned__extract_month
+ , subq_11.ds_partitioned__extract_day
+ , subq_11.ds_partitioned__extract_dow
+ , subq_11.ds_partitioned__extract_doy
+ , subq_11.customer_id__ds_partitioned__day
+ , subq_11.customer_id__ds_partitioned__week
+ , subq_11.customer_id__ds_partitioned__month
+ , subq_11.customer_id__ds_partitioned__quarter
+ , subq_11.customer_id__ds_partitioned__year
+ , subq_11.customer_id__ds_partitioned__extract_year
+ , subq_11.customer_id__ds_partitioned__extract_quarter
+ , subq_11.customer_id__ds_partitioned__extract_month
+ , subq_11.customer_id__ds_partitioned__extract_day
+ , subq_11.customer_id__ds_partitioned__extract_dow
+ , subq_11.customer_id__ds_partitioned__extract_doy
+ , subq_11.metric_time__day
+ , subq_11.metric_time__week
+ , subq_11.metric_time__month
+ , subq_11.metric_time__quarter
+ , subq_11.metric_time__year
+ , subq_11.metric_time__extract_year
+ , subq_11.metric_time__extract_quarter
+ , subq_11.metric_time__extract_month
+ , subq_11.metric_time__extract_day
+ , subq_11.metric_time__extract_dow
+ , subq_11.metric_time__extract_doy
+ , subq_11.customer_id
+ , subq_11.customer_name
+ , subq_11.customer_atomic_weight
+ , subq_11.customer_id__customer_name
+ , subq_11.customer_id__customer_atomic_weight
FROM (
- -- Read Elements From Semantic Model 'customer_table'
+ -- Metric Time Dimension 'ds_partitioned'
SELECT
- customer_table_src_22000.customer_name
- , customer_table_src_22000.customer_atomic_weight
- , DATE_TRUNC(customer_table_src_22000.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(customer_table_src_22000.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(customer_table_src_22000.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(customer_table_src_22000.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(customer_table_src_22000.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM customer_table_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM customer_table_src_22000.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
- , customer_table_src_22000.customer_name AS customer_id__customer_name
- , customer_table_src_22000.customer_atomic_weight AS customer_id__customer_atomic_weight
- , DATE_TRUNC(customer_table_src_22000.ds_partitioned, day) AS customer_id__ds_partitioned__day
- , DATE_TRUNC(customer_table_src_22000.ds_partitioned, isoweek) AS customer_id__ds_partitioned__week
- , DATE_TRUNC(customer_table_src_22000.ds_partitioned, month) AS customer_id__ds_partitioned__month
- , DATE_TRUNC(customer_table_src_22000.ds_partitioned, quarter) AS customer_id__ds_partitioned__quarter
- , DATE_TRUNC(customer_table_src_22000.ds_partitioned, year) AS customer_id__ds_partitioned__year
- , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_year
- , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter
- , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_month
- , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM customer_table_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM customer_table_src_22000.ds_partitioned) - 1) AS customer_id__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_doy
- , customer_table_src_22000.customer_id
- FROM ***************************.customer_table customer_table_src_22000
- ) subq_7
- ) subq_8
+ subq_10.ds_partitioned__day
+ , subq_10.ds_partitioned__week
+ , subq_10.ds_partitioned__month
+ , subq_10.ds_partitioned__quarter
+ , subq_10.ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy
+ , subq_10.customer_id__ds_partitioned__day
+ , subq_10.customer_id__ds_partitioned__week
+ , subq_10.customer_id__ds_partitioned__month
+ , subq_10.customer_id__ds_partitioned__quarter
+ , subq_10.customer_id__ds_partitioned__year
+ , subq_10.customer_id__ds_partitioned__extract_year
+ , subq_10.customer_id__ds_partitioned__extract_quarter
+ , subq_10.customer_id__ds_partitioned__extract_month
+ , subq_10.customer_id__ds_partitioned__extract_day
+ , subq_10.customer_id__ds_partitioned__extract_dow
+ , subq_10.customer_id__ds_partitioned__extract_doy
+ , subq_10.ds_partitioned__day AS metric_time__day
+ , subq_10.ds_partitioned__week AS metric_time__week
+ , subq_10.ds_partitioned__month AS metric_time__month
+ , subq_10.ds_partitioned__quarter AS metric_time__quarter
+ , subq_10.ds_partitioned__year AS metric_time__year
+ , subq_10.ds_partitioned__extract_year AS metric_time__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS metric_time__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS metric_time__extract_month
+ , subq_10.ds_partitioned__extract_day AS metric_time__extract_day
+ , subq_10.ds_partitioned__extract_dow AS metric_time__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS metric_time__extract_doy
+ , subq_10.customer_id
+ , subq_10.customer_name
+ , subq_10.customer_atomic_weight
+ , subq_10.customer_id__customer_name
+ , subq_10.customer_id__customer_atomic_weight
+ , subq_10.customers
+ FROM (
+ -- Read Elements From Semantic Model 'customer_table'
+ SELECT
+ 1 AS customers
+ , customer_table_src_22000.customer_name
+ , customer_table_src_22000.customer_atomic_weight
+ , DATE_TRUNC(customer_table_src_22000.ds_partitioned, day) AS ds_partitioned__day
+ , DATE_TRUNC(customer_table_src_22000.ds_partitioned, isoweek) AS ds_partitioned__week
+ , DATE_TRUNC(customer_table_src_22000.ds_partitioned, month) AS ds_partitioned__month
+ , DATE_TRUNC(customer_table_src_22000.ds_partitioned, quarter) AS ds_partitioned__quarter
+ , DATE_TRUNC(customer_table_src_22000.ds_partitioned, year) AS ds_partitioned__year
+ , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , IF(EXTRACT(dayofweek FROM customer_table_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM customer_table_src_22000.ds_partitioned) - 1) AS ds_partitioned__extract_dow
+ , EXTRACT(dayofyear FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , customer_table_src_22000.customer_name AS customer_id__customer_name
+ , customer_table_src_22000.customer_atomic_weight AS customer_id__customer_atomic_weight
+ , DATE_TRUNC(customer_table_src_22000.ds_partitioned, day) AS customer_id__ds_partitioned__day
+ , DATE_TRUNC(customer_table_src_22000.ds_partitioned, isoweek) AS customer_id__ds_partitioned__week
+ , DATE_TRUNC(customer_table_src_22000.ds_partitioned, month) AS customer_id__ds_partitioned__month
+ , DATE_TRUNC(customer_table_src_22000.ds_partitioned, quarter) AS customer_id__ds_partitioned__quarter
+ , DATE_TRUNC(customer_table_src_22000.ds_partitioned, year) AS customer_id__ds_partitioned__year
+ , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_day
+ , IF(EXTRACT(dayofweek FROM customer_table_src_22000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM customer_table_src_22000.ds_partitioned) - 1) AS customer_id__ds_partitioned__extract_dow
+ , EXTRACT(dayofyear FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_doy
+ , customer_table_src_22000.customer_id
+ FROM ***************************.customer_table customer_table_src_22000
+ ) subq_10
+ ) subq_11
+ ) subq_12
ON
(
- subq_6.customer_id = subq_8.customer_id
+ subq_9.customer_id = subq_12.customer_id
) AND (
- subq_6.ds_partitioned__day = subq_8.ds_partitioned__day
+ subq_9.ds_partitioned__day = subq_12.ds_partitioned__day
)
- ) subq_9
- ) subq_10
+ ) subq_13
+ ) subq_14
ON
(
- subq_5.account_id = subq_10.account_id
+ subq_7.account_id = subq_14.account_id
) AND (
- subq_5.ds_partitioned__day = subq_10.ds_partitioned__day
+ subq_7.ds_partitioned__day = subq_14.ds_partitioned__day
)
- ) subq_11
- ) subq_12
+ ) subq_15
+ ) subq_16
GROUP BY
account_id__customer_id__customer_name
-) subq_13
+) subq_17
diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0_optimized.sql
index c663ba3300..c7ff024aa7 100644
--- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0_optimized.sql
+++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/BigQuery/test_multihop_node__plan0_optimized.sql
@@ -3,7 +3,7 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_21.customer_id__customer_name AS account_id__customer_id__customer_name
+ subq_27.customer_id__customer_name AS account_id__customer_id__customer_name
, SUM(account_month_txns_src_22000.txn_count) AS txn_count
FROM ***************************.account_month_txns account_month_txns_src_22000
LEFT OUTER JOIN (
@@ -22,12 +22,12 @@ LEFT OUTER JOIN (
) AND (
DATE_TRUNC(bridge_table_src_22000.ds_partitioned, day) = DATE_TRUNC(customer_table_src_22000.ds_partitioned, day)
)
-) subq_21
+) subq_27
ON
(
- account_month_txns_src_22000.account_id = subq_21.account_id
+ account_month_txns_src_22000.account_id = subq_27.account_id
) AND (
- DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, day) = subq_21.ds_partitioned__day
+ DATE_TRUNC(account_month_txns_src_22000.ds_partitioned, day) = subq_27.ds_partitioned__day
)
GROUP BY
account_id__customer_id__customer_name
diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multihop_node__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multihop_node__plan0.sql
index ce8b6f4dc3..2ecc96050f 100644
--- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multihop_node__plan0.sql
+++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multihop_node__plan0.sql
@@ -1,93 +1,93 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.account_id__customer_id__customer_name
- , subq_13.txn_count
+ subq_17.account_id__customer_id__customer_name
+ , subq_17.txn_count
FROM (
-- Aggregate Measures
SELECT
- subq_12.account_id__customer_id__customer_name
- , SUM(subq_12.txn_count) AS txn_count
+ subq_16.account_id__customer_id__customer_name
+ , SUM(subq_16.txn_count) AS txn_count
FROM (
-- Pass Only Elements: ['txn_count', 'account_id__customer_id__customer_name']
SELECT
- subq_11.account_id__customer_id__customer_name
- , subq_11.txn_count
+ subq_15.account_id__customer_id__customer_name
+ , subq_15.txn_count
FROM (
-- Join Standard Outputs
SELECT
- subq_5.ds_partitioned__day AS ds_partitioned__day
- , subq_10.ds_partitioned__day AS account_id__ds_partitioned__day
- , subq_5.account_id AS account_id
- , subq_10.customer_id__customer_name AS account_id__customer_id__customer_name
- , subq_5.txn_count AS txn_count
+ subq_7.ds_partitioned__day AS ds_partitioned__day
+ , subq_14.ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_7.account_id AS account_id
+ , subq_14.customer_id__customer_name AS account_id__customer_id__customer_name
+ , subq_7.txn_count AS txn_count
FROM (
-- Pass Only Elements: ['txn_count', 'ds_partitioned__day', 'account_id']
SELECT
- subq_4.ds_partitioned__day
- , subq_4.account_id
- , subq_4.txn_count
+ subq_6.ds_partitioned__day
+ , subq_6.account_id
+ , subq_6.txn_count
FROM (
-- Metric Time Dimension 'ds'
SELECT
- 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.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.account_id__ds_partitioned__day
- , subq_3.account_id__ds_partitioned__week
- , subq_3.account_id__ds_partitioned__month
- , subq_3.account_id__ds_partitioned__quarter
- , subq_3.account_id__ds_partitioned__year
- , subq_3.account_id__ds_partitioned__extract_year
- , subq_3.account_id__ds_partitioned__extract_quarter
- , subq_3.account_id__ds_partitioned__extract_month
- , subq_3.account_id__ds_partitioned__extract_day
- , subq_3.account_id__ds_partitioned__extract_dow
- , subq_3.account_id__ds_partitioned__extract_doy
- , subq_3.account_id__ds__day
- , subq_3.account_id__ds__week
- , subq_3.account_id__ds__month
- , subq_3.account_id__ds__quarter
- , subq_3.account_id__ds__year
- , subq_3.account_id__ds__extract_year
- , subq_3.account_id__ds__extract_quarter
- , subq_3.account_id__ds__extract_month
- , subq_3.account_id__ds__extract_day
- , subq_3.account_id__ds__extract_dow
- , subq_3.account_id__ds__extract_doy
- , subq_3.ds__day AS metric_time__day
- , subq_3.ds__week AS metric_time__week
- , subq_3.ds__month AS metric_time__month
- , subq_3.ds__quarter AS metric_time__quarter
- , subq_3.ds__year AS metric_time__year
- , subq_3.ds__extract_year AS metric_time__extract_year
- , subq_3.ds__extract_quarter AS metric_time__extract_quarter
- , subq_3.ds__extract_month AS metric_time__extract_month
- , subq_3.ds__extract_day AS metric_time__extract_day
- , subq_3.ds__extract_dow AS metric_time__extract_dow
- , subq_3.ds__extract_doy AS metric_time__extract_doy
- , subq_3.account_id
- , subq_3.account_month
- , subq_3.account_id__account_month
- , subq_3.txn_count
+ subq_5.ds_partitioned__day
+ , subq_5.ds_partitioned__week
+ , subq_5.ds_partitioned__month
+ , subq_5.ds_partitioned__quarter
+ , subq_5.ds_partitioned__year
+ , subq_5.ds_partitioned__extract_year
+ , subq_5.ds_partitioned__extract_quarter
+ , subq_5.ds_partitioned__extract_month
+ , subq_5.ds_partitioned__extract_day
+ , subq_5.ds_partitioned__extract_dow
+ , subq_5.ds_partitioned__extract_doy
+ , subq_5.ds__day
+ , subq_5.ds__week
+ , subq_5.ds__month
+ , subq_5.ds__quarter
+ , subq_5.ds__year
+ , subq_5.ds__extract_year
+ , subq_5.ds__extract_quarter
+ , subq_5.ds__extract_month
+ , subq_5.ds__extract_day
+ , subq_5.ds__extract_dow
+ , subq_5.ds__extract_doy
+ , subq_5.account_id__ds_partitioned__day
+ , subq_5.account_id__ds_partitioned__week
+ , subq_5.account_id__ds_partitioned__month
+ , subq_5.account_id__ds_partitioned__quarter
+ , subq_5.account_id__ds_partitioned__year
+ , subq_5.account_id__ds_partitioned__extract_year
+ , subq_5.account_id__ds_partitioned__extract_quarter
+ , subq_5.account_id__ds_partitioned__extract_month
+ , subq_5.account_id__ds_partitioned__extract_day
+ , subq_5.account_id__ds_partitioned__extract_dow
+ , subq_5.account_id__ds_partitioned__extract_doy
+ , subq_5.account_id__ds__day
+ , subq_5.account_id__ds__week
+ , subq_5.account_id__ds__month
+ , subq_5.account_id__ds__quarter
+ , subq_5.account_id__ds__year
+ , subq_5.account_id__ds__extract_year
+ , subq_5.account_id__ds__extract_quarter
+ , subq_5.account_id__ds__extract_month
+ , subq_5.account_id__ds__extract_day
+ , subq_5.account_id__ds__extract_dow
+ , subq_5.account_id__ds__extract_doy
+ , subq_5.ds__day AS metric_time__day
+ , subq_5.ds__week AS metric_time__week
+ , subq_5.ds__month AS metric_time__month
+ , subq_5.ds__quarter AS metric_time__quarter
+ , subq_5.ds__year AS metric_time__year
+ , subq_5.ds__extract_year AS metric_time__extract_year
+ , subq_5.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_5.ds__extract_month AS metric_time__extract_month
+ , subq_5.ds__extract_day AS metric_time__extract_day
+ , subq_5.ds__extract_dow AS metric_time__extract_dow
+ , subq_5.ds__extract_doy AS metric_time__extract_doy
+ , subq_5.account_id
+ , subq_5.account_month
+ , subq_5.account_id__account_month
+ , subq_5.txn_count
FROM (
-- Read Elements From Semantic Model 'account_month_txns'
SELECT
@@ -140,118 +140,199 @@ FROM (
, account_month_txns_src_22000.account_month AS account_id__account_month
, account_month_txns_src_22000.account_id
FROM ***************************.account_month_txns account_month_txns_src_22000
- ) subq_3
- ) subq_4
- ) subq_5
+ ) subq_5
+ ) subq_6
+ ) subq_7
LEFT OUTER JOIN (
-- Pass Only Elements: ['customer_id__customer_name', 'ds_partitioned__day', 'account_id']
SELECT
- subq_9.ds_partitioned__day
- , subq_9.account_id
- , subq_9.customer_id__customer_name
+ subq_13.ds_partitioned__day
+ , subq_13.account_id
+ , subq_13.customer_id__customer_name
FROM (
-- Join Standard Outputs
SELECT
- subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.account_id__ds_partitioned__day AS account_id__ds_partitioned__day
- , subq_6.account_id__ds_partitioned__week AS account_id__ds_partitioned__week
- , subq_6.account_id__ds_partitioned__month AS account_id__ds_partitioned__month
- , subq_6.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter
- , subq_6.account_id__ds_partitioned__year AS account_id__ds_partitioned__year
- , subq_6.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year
- , subq_6.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter
- , subq_6.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month
- , subq_6.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day
- , subq_6.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow
- , subq_6.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy
- , subq_6.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day
- , subq_6.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week
- , subq_6.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month
- , subq_6.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter
- , subq_6.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year
- , subq_6.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year
- , subq_6.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter
- , subq_6.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month
- , subq_6.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day
- , subq_6.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow
- , subq_6.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy
- , subq_8.ds_partitioned__day AS customer_id__ds_partitioned__day
- , subq_8.ds_partitioned__week AS customer_id__ds_partitioned__week
- , subq_8.ds_partitioned__month AS customer_id__ds_partitioned__month
- , subq_8.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter
- , subq_8.ds_partitioned__year AS customer_id__ds_partitioned__year
- , subq_8.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year
- , subq_8.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter
- , subq_8.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month
- , subq_8.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day
- , subq_8.ds_partitioned__extract_dow AS customer_id__ds_partitioned__extract_dow
- , subq_8.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy
- , subq_6.account_id AS account_id
- , subq_6.customer_id AS customer_id
- , subq_6.account_id__customer_id AS account_id__customer_id
- , subq_6.bridge_account__account_id AS bridge_account__account_id
- , subq_6.bridge_account__customer_id AS bridge_account__customer_id
- , subq_6.extra_dim AS extra_dim
- , subq_6.account_id__extra_dim AS account_id__extra_dim
- , subq_6.bridge_account__extra_dim AS bridge_account__extra_dim
- , subq_8.customer_name AS customer_id__customer_name
- , subq_8.customer_atomic_weight AS customer_id__customer_atomic_weight
+ subq_9.ds_partitioned__day AS ds_partitioned__day
+ , subq_9.ds_partitioned__week AS ds_partitioned__week
+ , subq_9.ds_partitioned__month AS ds_partitioned__month
+ , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_9.ds_partitioned__year AS ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_9.account_id__ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_9.account_id__ds_partitioned__week AS account_id__ds_partitioned__week
+ , subq_9.account_id__ds_partitioned__month AS account_id__ds_partitioned__month
+ , subq_9.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter
+ , subq_9.account_id__ds_partitioned__year AS account_id__ds_partitioned__year
+ , subq_9.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year
+ , subq_9.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter
+ , subq_9.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month
+ , subq_9.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day
+ , subq_9.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow
+ , subq_9.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy
+ , subq_9.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day
+ , subq_9.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week
+ , subq_9.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month
+ , subq_9.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter
+ , subq_9.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year
+ , subq_9.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year
+ , subq_9.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter
+ , subq_9.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month
+ , subq_9.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day
+ , subq_9.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow
+ , subq_9.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy
+ , subq_9.metric_time__day AS metric_time__day
+ , subq_9.metric_time__week AS metric_time__week
+ , subq_9.metric_time__month AS metric_time__month
+ , subq_9.metric_time__quarter AS metric_time__quarter
+ , subq_9.metric_time__year AS metric_time__year
+ , subq_9.metric_time__extract_year AS metric_time__extract_year
+ , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_9.metric_time__extract_month AS metric_time__extract_month
+ , subq_9.metric_time__extract_day AS metric_time__extract_day
+ , subq_9.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_9.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_12.ds_partitioned__day AS customer_id__ds_partitioned__day
+ , subq_12.ds_partitioned__week AS customer_id__ds_partitioned__week
+ , subq_12.ds_partitioned__month AS customer_id__ds_partitioned__month
+ , subq_12.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter
+ , subq_12.ds_partitioned__year AS customer_id__ds_partitioned__year
+ , subq_12.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year
+ , subq_12.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter
+ , subq_12.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month
+ , subq_12.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day
+ , subq_12.ds_partitioned__extract_dow AS customer_id__ds_partitioned__extract_dow
+ , subq_12.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy
+ , subq_12.metric_time__day AS customer_id__metric_time__day
+ , subq_12.metric_time__week AS customer_id__metric_time__week
+ , subq_12.metric_time__month AS customer_id__metric_time__month
+ , subq_12.metric_time__quarter AS customer_id__metric_time__quarter
+ , subq_12.metric_time__year AS customer_id__metric_time__year
+ , subq_12.metric_time__extract_year AS customer_id__metric_time__extract_year
+ , subq_12.metric_time__extract_quarter AS customer_id__metric_time__extract_quarter
+ , subq_12.metric_time__extract_month AS customer_id__metric_time__extract_month
+ , subq_12.metric_time__extract_day AS customer_id__metric_time__extract_day
+ , subq_12.metric_time__extract_dow AS customer_id__metric_time__extract_dow
+ , subq_12.metric_time__extract_doy AS customer_id__metric_time__extract_doy
+ , subq_9.account_id AS account_id
+ , subq_9.customer_id AS customer_id
+ , subq_9.account_id__customer_id AS account_id__customer_id
+ , subq_9.bridge_account__account_id AS bridge_account__account_id
+ , subq_9.bridge_account__customer_id AS bridge_account__customer_id
+ , subq_9.extra_dim AS extra_dim
+ , subq_9.account_id__extra_dim AS account_id__extra_dim
+ , subq_9.bridge_account__extra_dim AS bridge_account__extra_dim
+ , subq_12.customer_name AS customer_id__customer_name
+ , subq_12.customer_atomic_weight AS customer_id__customer_atomic_weight
+ , subq_9.account_customer_combos AS account_customer_combos
FROM (
- -- Read Elements From Semantic Model 'bridge_table'
+ -- Metric Time Dimension 'ds_partitioned'
SELECT
- bridge_table_src_22000.extra_dim
- , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
- , bridge_table_src_22000.extra_dim AS account_id__extra_dim
- , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
- , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
- , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
- , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
- , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
- , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
- , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
- , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim
- , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__day
- , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__week
- , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__month
- , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__quarter
- , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__year
- , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month
- , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy
- , bridge_table_src_22000.account_id
- , bridge_table_src_22000.customer_id
- , bridge_table_src_22000.customer_id AS account_id__customer_id
- , bridge_table_src_22000.account_id AS bridge_account__account_id
- , bridge_table_src_22000.customer_id AS bridge_account__customer_id
- FROM ***************************.bridge_table bridge_table_src_22000
- ) subq_6
+ subq_8.ds_partitioned__day
+ , subq_8.ds_partitioned__week
+ , subq_8.ds_partitioned__month
+ , subq_8.ds_partitioned__quarter
+ , subq_8.ds_partitioned__year
+ , subq_8.ds_partitioned__extract_year
+ , subq_8.ds_partitioned__extract_quarter
+ , subq_8.ds_partitioned__extract_month
+ , subq_8.ds_partitioned__extract_day
+ , subq_8.ds_partitioned__extract_dow
+ , subq_8.ds_partitioned__extract_doy
+ , subq_8.account_id__ds_partitioned__day
+ , subq_8.account_id__ds_partitioned__week
+ , subq_8.account_id__ds_partitioned__month
+ , subq_8.account_id__ds_partitioned__quarter
+ , subq_8.account_id__ds_partitioned__year
+ , subq_8.account_id__ds_partitioned__extract_year
+ , subq_8.account_id__ds_partitioned__extract_quarter
+ , subq_8.account_id__ds_partitioned__extract_month
+ , subq_8.account_id__ds_partitioned__extract_day
+ , subq_8.account_id__ds_partitioned__extract_dow
+ , subq_8.account_id__ds_partitioned__extract_doy
+ , subq_8.bridge_account__ds_partitioned__day
+ , subq_8.bridge_account__ds_partitioned__week
+ , subq_8.bridge_account__ds_partitioned__month
+ , subq_8.bridge_account__ds_partitioned__quarter
+ , subq_8.bridge_account__ds_partitioned__year
+ , subq_8.bridge_account__ds_partitioned__extract_year
+ , subq_8.bridge_account__ds_partitioned__extract_quarter
+ , subq_8.bridge_account__ds_partitioned__extract_month
+ , subq_8.bridge_account__ds_partitioned__extract_day
+ , subq_8.bridge_account__ds_partitioned__extract_dow
+ , subq_8.bridge_account__ds_partitioned__extract_doy
+ , subq_8.ds_partitioned__day AS metric_time__day
+ , subq_8.ds_partitioned__week AS metric_time__week
+ , subq_8.ds_partitioned__month AS metric_time__month
+ , subq_8.ds_partitioned__quarter AS metric_time__quarter
+ , subq_8.ds_partitioned__year AS metric_time__year
+ , subq_8.ds_partitioned__extract_year AS metric_time__extract_year
+ , subq_8.ds_partitioned__extract_quarter AS metric_time__extract_quarter
+ , subq_8.ds_partitioned__extract_month AS metric_time__extract_month
+ , subq_8.ds_partitioned__extract_day AS metric_time__extract_day
+ , subq_8.ds_partitioned__extract_dow AS metric_time__extract_dow
+ , subq_8.ds_partitioned__extract_doy AS metric_time__extract_doy
+ , subq_8.account_id
+ , subq_8.customer_id
+ , subq_8.account_id__customer_id
+ , subq_8.bridge_account__account_id
+ , subq_8.bridge_account__customer_id
+ , subq_8.extra_dim
+ , subq_8.account_id__extra_dim
+ , subq_8.bridge_account__extra_dim
+ , subq_8.account_customer_combos
+ FROM (
+ -- Read Elements From Semantic Model 'bridge_table'
+ SELECT
+ account_id || customer_id AS account_customer_combos
+ , bridge_table_src_22000.extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS account_id__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy
+ , bridge_table_src_22000.account_id
+ , bridge_table_src_22000.customer_id
+ , bridge_table_src_22000.customer_id AS account_id__customer_id
+ , bridge_table_src_22000.account_id AS bridge_account__account_id
+ , bridge_table_src_22000.customer_id AS bridge_account__customer_id
+ FROM ***************************.bridge_table bridge_table_src_22000
+ ) subq_8
+ ) subq_9
LEFT OUTER JOIN (
-- Pass Only Elements: [
-- 'customer_name',
@@ -280,85 +361,151 @@ FROM (
-- 'customer_id__ds_partitioned__extract_day',
-- 'customer_id__ds_partitioned__extract_dow',
-- 'customer_id__ds_partitioned__extract_doy',
+ -- 'metric_time__day',
+ -- 'metric_time__week',
+ -- 'metric_time__month',
+ -- 'metric_time__quarter',
+ -- 'metric_time__year',
+ -- 'metric_time__extract_year',
+ -- 'metric_time__extract_quarter',
+ -- 'metric_time__extract_month',
+ -- 'metric_time__extract_day',
+ -- 'metric_time__extract_dow',
+ -- 'metric_time__extract_doy',
-- 'customer_id',
-- ]
SELECT
- subq_7.ds_partitioned__day
- , subq_7.ds_partitioned__week
- , subq_7.ds_partitioned__month
- , subq_7.ds_partitioned__quarter
- , subq_7.ds_partitioned__year
- , subq_7.ds_partitioned__extract_year
- , subq_7.ds_partitioned__extract_quarter
- , subq_7.ds_partitioned__extract_month
- , subq_7.ds_partitioned__extract_day
- , subq_7.ds_partitioned__extract_dow
- , subq_7.ds_partitioned__extract_doy
- , subq_7.customer_id__ds_partitioned__day
- , subq_7.customer_id__ds_partitioned__week
- , subq_7.customer_id__ds_partitioned__month
- , subq_7.customer_id__ds_partitioned__quarter
- , subq_7.customer_id__ds_partitioned__year
- , subq_7.customer_id__ds_partitioned__extract_year
- , subq_7.customer_id__ds_partitioned__extract_quarter
- , subq_7.customer_id__ds_partitioned__extract_month
- , subq_7.customer_id__ds_partitioned__extract_day
- , subq_7.customer_id__ds_partitioned__extract_dow
- , subq_7.customer_id__ds_partitioned__extract_doy
- , subq_7.customer_id
- , subq_7.customer_name
- , subq_7.customer_atomic_weight
- , subq_7.customer_id__customer_name
- , subq_7.customer_id__customer_atomic_weight
+ subq_11.ds_partitioned__day
+ , subq_11.ds_partitioned__week
+ , subq_11.ds_partitioned__month
+ , subq_11.ds_partitioned__quarter
+ , subq_11.ds_partitioned__year
+ , subq_11.ds_partitioned__extract_year
+ , subq_11.ds_partitioned__extract_quarter
+ , subq_11.ds_partitioned__extract_month
+ , subq_11.ds_partitioned__extract_day
+ , subq_11.ds_partitioned__extract_dow
+ , subq_11.ds_partitioned__extract_doy
+ , subq_11.customer_id__ds_partitioned__day
+ , subq_11.customer_id__ds_partitioned__week
+ , subq_11.customer_id__ds_partitioned__month
+ , subq_11.customer_id__ds_partitioned__quarter
+ , subq_11.customer_id__ds_partitioned__year
+ , subq_11.customer_id__ds_partitioned__extract_year
+ , subq_11.customer_id__ds_partitioned__extract_quarter
+ , subq_11.customer_id__ds_partitioned__extract_month
+ , subq_11.customer_id__ds_partitioned__extract_day
+ , subq_11.customer_id__ds_partitioned__extract_dow
+ , subq_11.customer_id__ds_partitioned__extract_doy
+ , subq_11.metric_time__day
+ , subq_11.metric_time__week
+ , subq_11.metric_time__month
+ , subq_11.metric_time__quarter
+ , subq_11.metric_time__year
+ , subq_11.metric_time__extract_year
+ , subq_11.metric_time__extract_quarter
+ , subq_11.metric_time__extract_month
+ , subq_11.metric_time__extract_day
+ , subq_11.metric_time__extract_dow
+ , subq_11.metric_time__extract_doy
+ , subq_11.customer_id
+ , subq_11.customer_name
+ , subq_11.customer_atomic_weight
+ , subq_11.customer_id__customer_name
+ , subq_11.customer_id__customer_atomic_weight
FROM (
- -- Read Elements From Semantic Model 'customer_table'
+ -- Metric Time Dimension 'ds_partitioned'
SELECT
- customer_table_src_22000.customer_name
- , customer_table_src_22000.customer_atomic_weight
- , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
- , customer_table_src_22000.customer_name AS customer_id__customer_name
- , customer_table_src_22000.customer_atomic_weight AS customer_id__customer_atomic_weight
- , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__day
- , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__week
- , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__month
- , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__quarter
- , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__year
- , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_year
- , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter
- , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_month
- , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_dow
- , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_doy
- , customer_table_src_22000.customer_id
- FROM ***************************.customer_table customer_table_src_22000
- ) subq_7
- ) subq_8
+ subq_10.ds_partitioned__day
+ , subq_10.ds_partitioned__week
+ , subq_10.ds_partitioned__month
+ , subq_10.ds_partitioned__quarter
+ , subq_10.ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy
+ , subq_10.customer_id__ds_partitioned__day
+ , subq_10.customer_id__ds_partitioned__week
+ , subq_10.customer_id__ds_partitioned__month
+ , subq_10.customer_id__ds_partitioned__quarter
+ , subq_10.customer_id__ds_partitioned__year
+ , subq_10.customer_id__ds_partitioned__extract_year
+ , subq_10.customer_id__ds_partitioned__extract_quarter
+ , subq_10.customer_id__ds_partitioned__extract_month
+ , subq_10.customer_id__ds_partitioned__extract_day
+ , subq_10.customer_id__ds_partitioned__extract_dow
+ , subq_10.customer_id__ds_partitioned__extract_doy
+ , subq_10.ds_partitioned__day AS metric_time__day
+ , subq_10.ds_partitioned__week AS metric_time__week
+ , subq_10.ds_partitioned__month AS metric_time__month
+ , subq_10.ds_partitioned__quarter AS metric_time__quarter
+ , subq_10.ds_partitioned__year AS metric_time__year
+ , subq_10.ds_partitioned__extract_year AS metric_time__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS metric_time__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS metric_time__extract_month
+ , subq_10.ds_partitioned__extract_day AS metric_time__extract_day
+ , subq_10.ds_partitioned__extract_dow AS metric_time__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS metric_time__extract_doy
+ , subq_10.customer_id
+ , subq_10.customer_name
+ , subq_10.customer_atomic_weight
+ , subq_10.customer_id__customer_name
+ , subq_10.customer_id__customer_atomic_weight
+ , subq_10.customers
+ FROM (
+ -- Read Elements From Semantic Model 'customer_table'
+ SELECT
+ 1 AS customers
+ , customer_table_src_22000.customer_name
+ , customer_table_src_22000.customer_atomic_weight
+ , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , customer_table_src_22000.customer_name AS customer_id__customer_name
+ , customer_table_src_22000.customer_atomic_weight AS customer_id__customer_atomic_weight
+ , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__day
+ , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__week
+ , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__year
+ , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_doy
+ , customer_table_src_22000.customer_id
+ FROM ***************************.customer_table customer_table_src_22000
+ ) subq_10
+ ) subq_11
+ ) subq_12
ON
(
- subq_6.customer_id = subq_8.customer_id
+ subq_9.customer_id = subq_12.customer_id
) AND (
- subq_6.ds_partitioned__day = subq_8.ds_partitioned__day
+ subq_9.ds_partitioned__day = subq_12.ds_partitioned__day
)
- ) subq_9
- ) subq_10
+ ) subq_13
+ ) subq_14
ON
(
- subq_5.account_id = subq_10.account_id
+ subq_7.account_id = subq_14.account_id
) AND (
- subq_5.ds_partitioned__day = subq_10.ds_partitioned__day
+ subq_7.ds_partitioned__day = subq_14.ds_partitioned__day
)
- ) subq_11
- ) subq_12
+ ) subq_15
+ ) subq_16
GROUP BY
- subq_12.account_id__customer_id__customer_name
-) subq_13
+ subq_16.account_id__customer_id__customer_name
+) subq_17
diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multihop_node__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multihop_node__plan0_optimized.sql
index 3081559380..ee22b130fc 100644
--- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multihop_node__plan0_optimized.sql
+++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Databricks/test_multihop_node__plan0_optimized.sql
@@ -3,7 +3,7 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_21.customer_id__customer_name AS account_id__customer_id__customer_name
+ subq_27.customer_id__customer_name AS account_id__customer_id__customer_name
, SUM(account_month_txns_src_22000.txn_count) AS txn_count
FROM ***************************.account_month_txns account_month_txns_src_22000
LEFT OUTER JOIN (
@@ -22,12 +22,12 @@ LEFT OUTER JOIN (
) AND (
DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) = DATE_TRUNC('day', customer_table_src_22000.ds_partitioned)
)
-) subq_21
+) subq_27
ON
(
- account_month_txns_src_22000.account_id = subq_21.account_id
+ account_month_txns_src_22000.account_id = subq_27.account_id
) AND (
- DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_21.ds_partitioned__day
+ DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_27.ds_partitioned__day
)
GROUP BY
- subq_21.customer_id__customer_name
+ subq_27.customer_id__customer_name
diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0.sql
index 80ac54f844..e4e771cb7c 100644
--- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0.sql
+++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0.sql
@@ -1,93 +1,93 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.account_id__customer_id__customer_name
- , subq_13.txn_count
+ subq_17.account_id__customer_id__customer_name
+ , subq_17.txn_count
FROM (
-- Aggregate Measures
SELECT
- subq_12.account_id__customer_id__customer_name
- , SUM(subq_12.txn_count) AS txn_count
+ subq_16.account_id__customer_id__customer_name
+ , SUM(subq_16.txn_count) AS txn_count
FROM (
-- Pass Only Elements: ['txn_count', 'account_id__customer_id__customer_name']
SELECT
- subq_11.account_id__customer_id__customer_name
- , subq_11.txn_count
+ subq_15.account_id__customer_id__customer_name
+ , subq_15.txn_count
FROM (
-- Join Standard Outputs
SELECT
- subq_5.ds_partitioned__day AS ds_partitioned__day
- , subq_10.ds_partitioned__day AS account_id__ds_partitioned__day
- , subq_5.account_id AS account_id
- , subq_10.customer_id__customer_name AS account_id__customer_id__customer_name
- , subq_5.txn_count AS txn_count
+ subq_7.ds_partitioned__day AS ds_partitioned__day
+ , subq_14.ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_7.account_id AS account_id
+ , subq_14.customer_id__customer_name AS account_id__customer_id__customer_name
+ , subq_7.txn_count AS txn_count
FROM (
-- Pass Only Elements: ['txn_count', 'ds_partitioned__day', 'account_id']
SELECT
- subq_4.ds_partitioned__day
- , subq_4.account_id
- , subq_4.txn_count
+ subq_6.ds_partitioned__day
+ , subq_6.account_id
+ , subq_6.txn_count
FROM (
-- Metric Time Dimension 'ds'
SELECT
- 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.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.account_id__ds_partitioned__day
- , subq_3.account_id__ds_partitioned__week
- , subq_3.account_id__ds_partitioned__month
- , subq_3.account_id__ds_partitioned__quarter
- , subq_3.account_id__ds_partitioned__year
- , subq_3.account_id__ds_partitioned__extract_year
- , subq_3.account_id__ds_partitioned__extract_quarter
- , subq_3.account_id__ds_partitioned__extract_month
- , subq_3.account_id__ds_partitioned__extract_day
- , subq_3.account_id__ds_partitioned__extract_dow
- , subq_3.account_id__ds_partitioned__extract_doy
- , subq_3.account_id__ds__day
- , subq_3.account_id__ds__week
- , subq_3.account_id__ds__month
- , subq_3.account_id__ds__quarter
- , subq_3.account_id__ds__year
- , subq_3.account_id__ds__extract_year
- , subq_3.account_id__ds__extract_quarter
- , subq_3.account_id__ds__extract_month
- , subq_3.account_id__ds__extract_day
- , subq_3.account_id__ds__extract_dow
- , subq_3.account_id__ds__extract_doy
- , subq_3.ds__day AS metric_time__day
- , subq_3.ds__week AS metric_time__week
- , subq_3.ds__month AS metric_time__month
- , subq_3.ds__quarter AS metric_time__quarter
- , subq_3.ds__year AS metric_time__year
- , subq_3.ds__extract_year AS metric_time__extract_year
- , subq_3.ds__extract_quarter AS metric_time__extract_quarter
- , subq_3.ds__extract_month AS metric_time__extract_month
- , subq_3.ds__extract_day AS metric_time__extract_day
- , subq_3.ds__extract_dow AS metric_time__extract_dow
- , subq_3.ds__extract_doy AS metric_time__extract_doy
- , subq_3.account_id
- , subq_3.account_month
- , subq_3.account_id__account_month
- , subq_3.txn_count
+ subq_5.ds_partitioned__day
+ , subq_5.ds_partitioned__week
+ , subq_5.ds_partitioned__month
+ , subq_5.ds_partitioned__quarter
+ , subq_5.ds_partitioned__year
+ , subq_5.ds_partitioned__extract_year
+ , subq_5.ds_partitioned__extract_quarter
+ , subq_5.ds_partitioned__extract_month
+ , subq_5.ds_partitioned__extract_day
+ , subq_5.ds_partitioned__extract_dow
+ , subq_5.ds_partitioned__extract_doy
+ , subq_5.ds__day
+ , subq_5.ds__week
+ , subq_5.ds__month
+ , subq_5.ds__quarter
+ , subq_5.ds__year
+ , subq_5.ds__extract_year
+ , subq_5.ds__extract_quarter
+ , subq_5.ds__extract_month
+ , subq_5.ds__extract_day
+ , subq_5.ds__extract_dow
+ , subq_5.ds__extract_doy
+ , subq_5.account_id__ds_partitioned__day
+ , subq_5.account_id__ds_partitioned__week
+ , subq_5.account_id__ds_partitioned__month
+ , subq_5.account_id__ds_partitioned__quarter
+ , subq_5.account_id__ds_partitioned__year
+ , subq_5.account_id__ds_partitioned__extract_year
+ , subq_5.account_id__ds_partitioned__extract_quarter
+ , subq_5.account_id__ds_partitioned__extract_month
+ , subq_5.account_id__ds_partitioned__extract_day
+ , subq_5.account_id__ds_partitioned__extract_dow
+ , subq_5.account_id__ds_partitioned__extract_doy
+ , subq_5.account_id__ds__day
+ , subq_5.account_id__ds__week
+ , subq_5.account_id__ds__month
+ , subq_5.account_id__ds__quarter
+ , subq_5.account_id__ds__year
+ , subq_5.account_id__ds__extract_year
+ , subq_5.account_id__ds__extract_quarter
+ , subq_5.account_id__ds__extract_month
+ , subq_5.account_id__ds__extract_day
+ , subq_5.account_id__ds__extract_dow
+ , subq_5.account_id__ds__extract_doy
+ , subq_5.ds__day AS metric_time__day
+ , subq_5.ds__week AS metric_time__week
+ , subq_5.ds__month AS metric_time__month
+ , subq_5.ds__quarter AS metric_time__quarter
+ , subq_5.ds__year AS metric_time__year
+ , subq_5.ds__extract_year AS metric_time__extract_year
+ , subq_5.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_5.ds__extract_month AS metric_time__extract_month
+ , subq_5.ds__extract_day AS metric_time__extract_day
+ , subq_5.ds__extract_dow AS metric_time__extract_dow
+ , subq_5.ds__extract_doy AS metric_time__extract_doy
+ , subq_5.account_id
+ , subq_5.account_month
+ , subq_5.account_id__account_month
+ , subq_5.txn_count
FROM (
-- Read Elements From Semantic Model 'account_month_txns'
SELECT
@@ -140,118 +140,199 @@ FROM (
, account_month_txns_src_22000.account_month AS account_id__account_month
, account_month_txns_src_22000.account_id
FROM ***************************.account_month_txns account_month_txns_src_22000
- ) subq_3
- ) subq_4
- ) subq_5
+ ) subq_5
+ ) subq_6
+ ) subq_7
LEFT OUTER JOIN (
-- Pass Only Elements: ['customer_id__customer_name', 'ds_partitioned__day', 'account_id']
SELECT
- subq_9.ds_partitioned__day
- , subq_9.account_id
- , subq_9.customer_id__customer_name
+ subq_13.ds_partitioned__day
+ , subq_13.account_id
+ , subq_13.customer_id__customer_name
FROM (
-- Join Standard Outputs
SELECT
- subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.account_id__ds_partitioned__day AS account_id__ds_partitioned__day
- , subq_6.account_id__ds_partitioned__week AS account_id__ds_partitioned__week
- , subq_6.account_id__ds_partitioned__month AS account_id__ds_partitioned__month
- , subq_6.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter
- , subq_6.account_id__ds_partitioned__year AS account_id__ds_partitioned__year
- , subq_6.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year
- , subq_6.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter
- , subq_6.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month
- , subq_6.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day
- , subq_6.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow
- , subq_6.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy
- , subq_6.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day
- , subq_6.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week
- , subq_6.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month
- , subq_6.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter
- , subq_6.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year
- , subq_6.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year
- , subq_6.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter
- , subq_6.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month
- , subq_6.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day
- , subq_6.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow
- , subq_6.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy
- , subq_8.ds_partitioned__day AS customer_id__ds_partitioned__day
- , subq_8.ds_partitioned__week AS customer_id__ds_partitioned__week
- , subq_8.ds_partitioned__month AS customer_id__ds_partitioned__month
- , subq_8.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter
- , subq_8.ds_partitioned__year AS customer_id__ds_partitioned__year
- , subq_8.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year
- , subq_8.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter
- , subq_8.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month
- , subq_8.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day
- , subq_8.ds_partitioned__extract_dow AS customer_id__ds_partitioned__extract_dow
- , subq_8.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy
- , subq_6.account_id AS account_id
- , subq_6.customer_id AS customer_id
- , subq_6.account_id__customer_id AS account_id__customer_id
- , subq_6.bridge_account__account_id AS bridge_account__account_id
- , subq_6.bridge_account__customer_id AS bridge_account__customer_id
- , subq_6.extra_dim AS extra_dim
- , subq_6.account_id__extra_dim AS account_id__extra_dim
- , subq_6.bridge_account__extra_dim AS bridge_account__extra_dim
- , subq_8.customer_name AS customer_id__customer_name
- , subq_8.customer_atomic_weight AS customer_id__customer_atomic_weight
+ subq_9.ds_partitioned__day AS ds_partitioned__day
+ , subq_9.ds_partitioned__week AS ds_partitioned__week
+ , subq_9.ds_partitioned__month AS ds_partitioned__month
+ , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_9.ds_partitioned__year AS ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_9.account_id__ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_9.account_id__ds_partitioned__week AS account_id__ds_partitioned__week
+ , subq_9.account_id__ds_partitioned__month AS account_id__ds_partitioned__month
+ , subq_9.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter
+ , subq_9.account_id__ds_partitioned__year AS account_id__ds_partitioned__year
+ , subq_9.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year
+ , subq_9.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter
+ , subq_9.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month
+ , subq_9.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day
+ , subq_9.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow
+ , subq_9.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy
+ , subq_9.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day
+ , subq_9.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week
+ , subq_9.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month
+ , subq_9.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter
+ , subq_9.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year
+ , subq_9.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year
+ , subq_9.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter
+ , subq_9.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month
+ , subq_9.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day
+ , subq_9.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow
+ , subq_9.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy
+ , subq_9.metric_time__day AS metric_time__day
+ , subq_9.metric_time__week AS metric_time__week
+ , subq_9.metric_time__month AS metric_time__month
+ , subq_9.metric_time__quarter AS metric_time__quarter
+ , subq_9.metric_time__year AS metric_time__year
+ , subq_9.metric_time__extract_year AS metric_time__extract_year
+ , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_9.metric_time__extract_month AS metric_time__extract_month
+ , subq_9.metric_time__extract_day AS metric_time__extract_day
+ , subq_9.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_9.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_12.ds_partitioned__day AS customer_id__ds_partitioned__day
+ , subq_12.ds_partitioned__week AS customer_id__ds_partitioned__week
+ , subq_12.ds_partitioned__month AS customer_id__ds_partitioned__month
+ , subq_12.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter
+ , subq_12.ds_partitioned__year AS customer_id__ds_partitioned__year
+ , subq_12.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year
+ , subq_12.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter
+ , subq_12.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month
+ , subq_12.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day
+ , subq_12.ds_partitioned__extract_dow AS customer_id__ds_partitioned__extract_dow
+ , subq_12.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy
+ , subq_12.metric_time__day AS customer_id__metric_time__day
+ , subq_12.metric_time__week AS customer_id__metric_time__week
+ , subq_12.metric_time__month AS customer_id__metric_time__month
+ , subq_12.metric_time__quarter AS customer_id__metric_time__quarter
+ , subq_12.metric_time__year AS customer_id__metric_time__year
+ , subq_12.metric_time__extract_year AS customer_id__metric_time__extract_year
+ , subq_12.metric_time__extract_quarter AS customer_id__metric_time__extract_quarter
+ , subq_12.metric_time__extract_month AS customer_id__metric_time__extract_month
+ , subq_12.metric_time__extract_day AS customer_id__metric_time__extract_day
+ , subq_12.metric_time__extract_dow AS customer_id__metric_time__extract_dow
+ , subq_12.metric_time__extract_doy AS customer_id__metric_time__extract_doy
+ , subq_9.account_id AS account_id
+ , subq_9.customer_id AS customer_id
+ , subq_9.account_id__customer_id AS account_id__customer_id
+ , subq_9.bridge_account__account_id AS bridge_account__account_id
+ , subq_9.bridge_account__customer_id AS bridge_account__customer_id
+ , subq_9.extra_dim AS extra_dim
+ , subq_9.account_id__extra_dim AS account_id__extra_dim
+ , subq_9.bridge_account__extra_dim AS bridge_account__extra_dim
+ , subq_12.customer_name AS customer_id__customer_name
+ , subq_12.customer_atomic_weight AS customer_id__customer_atomic_weight
+ , subq_9.account_customer_combos AS account_customer_combos
FROM (
- -- Read Elements From Semantic Model 'bridge_table'
+ -- Metric Time Dimension 'ds_partitioned'
SELECT
- bridge_table_src_22000.extra_dim
- , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
- , bridge_table_src_22000.extra_dim AS account_id__extra_dim
- , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
- , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
- , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
- , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
- , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
- , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
- , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
- , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim
- , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__day
- , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__week
- , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__month
- , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__quarter
- , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__year
- , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month
- , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy
- , bridge_table_src_22000.account_id
- , bridge_table_src_22000.customer_id
- , bridge_table_src_22000.customer_id AS account_id__customer_id
- , bridge_table_src_22000.account_id AS bridge_account__account_id
- , bridge_table_src_22000.customer_id AS bridge_account__customer_id
- FROM ***************************.bridge_table bridge_table_src_22000
- ) subq_6
+ subq_8.ds_partitioned__day
+ , subq_8.ds_partitioned__week
+ , subq_8.ds_partitioned__month
+ , subq_8.ds_partitioned__quarter
+ , subq_8.ds_partitioned__year
+ , subq_8.ds_partitioned__extract_year
+ , subq_8.ds_partitioned__extract_quarter
+ , subq_8.ds_partitioned__extract_month
+ , subq_8.ds_partitioned__extract_day
+ , subq_8.ds_partitioned__extract_dow
+ , subq_8.ds_partitioned__extract_doy
+ , subq_8.account_id__ds_partitioned__day
+ , subq_8.account_id__ds_partitioned__week
+ , subq_8.account_id__ds_partitioned__month
+ , subq_8.account_id__ds_partitioned__quarter
+ , subq_8.account_id__ds_partitioned__year
+ , subq_8.account_id__ds_partitioned__extract_year
+ , subq_8.account_id__ds_partitioned__extract_quarter
+ , subq_8.account_id__ds_partitioned__extract_month
+ , subq_8.account_id__ds_partitioned__extract_day
+ , subq_8.account_id__ds_partitioned__extract_dow
+ , subq_8.account_id__ds_partitioned__extract_doy
+ , subq_8.bridge_account__ds_partitioned__day
+ , subq_8.bridge_account__ds_partitioned__week
+ , subq_8.bridge_account__ds_partitioned__month
+ , subq_8.bridge_account__ds_partitioned__quarter
+ , subq_8.bridge_account__ds_partitioned__year
+ , subq_8.bridge_account__ds_partitioned__extract_year
+ , subq_8.bridge_account__ds_partitioned__extract_quarter
+ , subq_8.bridge_account__ds_partitioned__extract_month
+ , subq_8.bridge_account__ds_partitioned__extract_day
+ , subq_8.bridge_account__ds_partitioned__extract_dow
+ , subq_8.bridge_account__ds_partitioned__extract_doy
+ , subq_8.ds_partitioned__day AS metric_time__day
+ , subq_8.ds_partitioned__week AS metric_time__week
+ , subq_8.ds_partitioned__month AS metric_time__month
+ , subq_8.ds_partitioned__quarter AS metric_time__quarter
+ , subq_8.ds_partitioned__year AS metric_time__year
+ , subq_8.ds_partitioned__extract_year AS metric_time__extract_year
+ , subq_8.ds_partitioned__extract_quarter AS metric_time__extract_quarter
+ , subq_8.ds_partitioned__extract_month AS metric_time__extract_month
+ , subq_8.ds_partitioned__extract_day AS metric_time__extract_day
+ , subq_8.ds_partitioned__extract_dow AS metric_time__extract_dow
+ , subq_8.ds_partitioned__extract_doy AS metric_time__extract_doy
+ , subq_8.account_id
+ , subq_8.customer_id
+ , subq_8.account_id__customer_id
+ , subq_8.bridge_account__account_id
+ , subq_8.bridge_account__customer_id
+ , subq_8.extra_dim
+ , subq_8.account_id__extra_dim
+ , subq_8.bridge_account__extra_dim
+ , subq_8.account_customer_combos
+ FROM (
+ -- Read Elements From Semantic Model 'bridge_table'
+ SELECT
+ account_id || customer_id AS account_customer_combos
+ , bridge_table_src_22000.extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(isodow FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS account_id__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
+ , EXTRACT(isodow FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_day
+ , EXTRACT(isodow FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy
+ , bridge_table_src_22000.account_id
+ , bridge_table_src_22000.customer_id
+ , bridge_table_src_22000.customer_id AS account_id__customer_id
+ , bridge_table_src_22000.account_id AS bridge_account__account_id
+ , bridge_table_src_22000.customer_id AS bridge_account__customer_id
+ FROM ***************************.bridge_table bridge_table_src_22000
+ ) subq_8
+ ) subq_9
LEFT OUTER JOIN (
-- Pass Only Elements: [
-- 'customer_name',
@@ -280,85 +361,151 @@ FROM (
-- 'customer_id__ds_partitioned__extract_day',
-- 'customer_id__ds_partitioned__extract_dow',
-- 'customer_id__ds_partitioned__extract_doy',
+ -- 'metric_time__day',
+ -- 'metric_time__week',
+ -- 'metric_time__month',
+ -- 'metric_time__quarter',
+ -- 'metric_time__year',
+ -- 'metric_time__extract_year',
+ -- 'metric_time__extract_quarter',
+ -- 'metric_time__extract_month',
+ -- 'metric_time__extract_day',
+ -- 'metric_time__extract_dow',
+ -- 'metric_time__extract_doy',
-- 'customer_id',
-- ]
SELECT
- subq_7.ds_partitioned__day
- , subq_7.ds_partitioned__week
- , subq_7.ds_partitioned__month
- , subq_7.ds_partitioned__quarter
- , subq_7.ds_partitioned__year
- , subq_7.ds_partitioned__extract_year
- , subq_7.ds_partitioned__extract_quarter
- , subq_7.ds_partitioned__extract_month
- , subq_7.ds_partitioned__extract_day
- , subq_7.ds_partitioned__extract_dow
- , subq_7.ds_partitioned__extract_doy
- , subq_7.customer_id__ds_partitioned__day
- , subq_7.customer_id__ds_partitioned__week
- , subq_7.customer_id__ds_partitioned__month
- , subq_7.customer_id__ds_partitioned__quarter
- , subq_7.customer_id__ds_partitioned__year
- , subq_7.customer_id__ds_partitioned__extract_year
- , subq_7.customer_id__ds_partitioned__extract_quarter
- , subq_7.customer_id__ds_partitioned__extract_month
- , subq_7.customer_id__ds_partitioned__extract_day
- , subq_7.customer_id__ds_partitioned__extract_dow
- , subq_7.customer_id__ds_partitioned__extract_doy
- , subq_7.customer_id
- , subq_7.customer_name
- , subq_7.customer_atomic_weight
- , subq_7.customer_id__customer_name
- , subq_7.customer_id__customer_atomic_weight
+ subq_11.ds_partitioned__day
+ , subq_11.ds_partitioned__week
+ , subq_11.ds_partitioned__month
+ , subq_11.ds_partitioned__quarter
+ , subq_11.ds_partitioned__year
+ , subq_11.ds_partitioned__extract_year
+ , subq_11.ds_partitioned__extract_quarter
+ , subq_11.ds_partitioned__extract_month
+ , subq_11.ds_partitioned__extract_day
+ , subq_11.ds_partitioned__extract_dow
+ , subq_11.ds_partitioned__extract_doy
+ , subq_11.customer_id__ds_partitioned__day
+ , subq_11.customer_id__ds_partitioned__week
+ , subq_11.customer_id__ds_partitioned__month
+ , subq_11.customer_id__ds_partitioned__quarter
+ , subq_11.customer_id__ds_partitioned__year
+ , subq_11.customer_id__ds_partitioned__extract_year
+ , subq_11.customer_id__ds_partitioned__extract_quarter
+ , subq_11.customer_id__ds_partitioned__extract_month
+ , subq_11.customer_id__ds_partitioned__extract_day
+ , subq_11.customer_id__ds_partitioned__extract_dow
+ , subq_11.customer_id__ds_partitioned__extract_doy
+ , subq_11.metric_time__day
+ , subq_11.metric_time__week
+ , subq_11.metric_time__month
+ , subq_11.metric_time__quarter
+ , subq_11.metric_time__year
+ , subq_11.metric_time__extract_year
+ , subq_11.metric_time__extract_quarter
+ , subq_11.metric_time__extract_month
+ , subq_11.metric_time__extract_day
+ , subq_11.metric_time__extract_dow
+ , subq_11.metric_time__extract_doy
+ , subq_11.customer_id
+ , subq_11.customer_name
+ , subq_11.customer_atomic_weight
+ , subq_11.customer_id__customer_name
+ , subq_11.customer_id__customer_atomic_weight
FROM (
- -- Read Elements From Semantic Model 'customer_table'
+ -- Metric Time Dimension 'ds_partitioned'
SELECT
- customer_table_src_22000.customer_name
- , customer_table_src_22000.customer_atomic_weight
- , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
- , customer_table_src_22000.customer_name AS customer_id__customer_name
- , customer_table_src_22000.customer_atomic_weight AS customer_id__customer_atomic_weight
- , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__day
- , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__week
- , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__month
- , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__quarter
- , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__year
- , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_year
- , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter
- , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_month
- , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_day
- , EXTRACT(isodow FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_dow
- , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_doy
- , customer_table_src_22000.customer_id
- FROM ***************************.customer_table customer_table_src_22000
- ) subq_7
- ) subq_8
+ subq_10.ds_partitioned__day
+ , subq_10.ds_partitioned__week
+ , subq_10.ds_partitioned__month
+ , subq_10.ds_partitioned__quarter
+ , subq_10.ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy
+ , subq_10.customer_id__ds_partitioned__day
+ , subq_10.customer_id__ds_partitioned__week
+ , subq_10.customer_id__ds_partitioned__month
+ , subq_10.customer_id__ds_partitioned__quarter
+ , subq_10.customer_id__ds_partitioned__year
+ , subq_10.customer_id__ds_partitioned__extract_year
+ , subq_10.customer_id__ds_partitioned__extract_quarter
+ , subq_10.customer_id__ds_partitioned__extract_month
+ , subq_10.customer_id__ds_partitioned__extract_day
+ , subq_10.customer_id__ds_partitioned__extract_dow
+ , subq_10.customer_id__ds_partitioned__extract_doy
+ , subq_10.ds_partitioned__day AS metric_time__day
+ , subq_10.ds_partitioned__week AS metric_time__week
+ , subq_10.ds_partitioned__month AS metric_time__month
+ , subq_10.ds_partitioned__quarter AS metric_time__quarter
+ , subq_10.ds_partitioned__year AS metric_time__year
+ , subq_10.ds_partitioned__extract_year AS metric_time__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS metric_time__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS metric_time__extract_month
+ , subq_10.ds_partitioned__extract_day AS metric_time__extract_day
+ , subq_10.ds_partitioned__extract_dow AS metric_time__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS metric_time__extract_doy
+ , subq_10.customer_id
+ , subq_10.customer_name
+ , subq_10.customer_atomic_weight
+ , subq_10.customer_id__customer_name
+ , subq_10.customer_id__customer_atomic_weight
+ , subq_10.customers
+ FROM (
+ -- Read Elements From Semantic Model 'customer_table'
+ SELECT
+ 1 AS customers
+ , customer_table_src_22000.customer_name
+ , customer_table_src_22000.customer_atomic_weight
+ , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(isodow FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , customer_table_src_22000.customer_name AS customer_id__customer_name
+ , customer_table_src_22000.customer_atomic_weight AS customer_id__customer_atomic_weight
+ , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__day
+ , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__week
+ , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__year
+ , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_day
+ , EXTRACT(isodow FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_doy
+ , customer_table_src_22000.customer_id
+ FROM ***************************.customer_table customer_table_src_22000
+ ) subq_10
+ ) subq_11
+ ) subq_12
ON
(
- subq_6.customer_id = subq_8.customer_id
+ subq_9.customer_id = subq_12.customer_id
) AND (
- subq_6.ds_partitioned__day = subq_8.ds_partitioned__day
+ subq_9.ds_partitioned__day = subq_12.ds_partitioned__day
)
- ) subq_9
- ) subq_10
+ ) subq_13
+ ) subq_14
ON
(
- subq_5.account_id = subq_10.account_id
+ subq_7.account_id = subq_14.account_id
) AND (
- subq_5.ds_partitioned__day = subq_10.ds_partitioned__day
+ subq_7.ds_partitioned__day = subq_14.ds_partitioned__day
)
- ) subq_11
- ) subq_12
+ ) subq_15
+ ) subq_16
GROUP BY
- subq_12.account_id__customer_id__customer_name
-) subq_13
+ subq_16.account_id__customer_id__customer_name
+) subq_17
diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0_optimized.sql
index 3081559380..ee22b130fc 100644
--- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0_optimized.sql
+++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multihop_node__plan0_optimized.sql
@@ -3,7 +3,7 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_21.customer_id__customer_name AS account_id__customer_id__customer_name
+ subq_27.customer_id__customer_name AS account_id__customer_id__customer_name
, SUM(account_month_txns_src_22000.txn_count) AS txn_count
FROM ***************************.account_month_txns account_month_txns_src_22000
LEFT OUTER JOIN (
@@ -22,12 +22,12 @@ LEFT OUTER JOIN (
) AND (
DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) = DATE_TRUNC('day', customer_table_src_22000.ds_partitioned)
)
-) subq_21
+) subq_27
ON
(
- account_month_txns_src_22000.account_id = subq_21.account_id
+ account_month_txns_src_22000.account_id = subq_27.account_id
) AND (
- DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_21.ds_partitioned__day
+ DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_27.ds_partitioned__day
)
GROUP BY
- subq_21.customer_id__customer_name
+ subq_27.customer_id__customer_name
diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multihop_node__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multihop_node__plan0.sql
index 80ac54f844..e4e771cb7c 100644
--- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multihop_node__plan0.sql
+++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multihop_node__plan0.sql
@@ -1,93 +1,93 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.account_id__customer_id__customer_name
- , subq_13.txn_count
+ subq_17.account_id__customer_id__customer_name
+ , subq_17.txn_count
FROM (
-- Aggregate Measures
SELECT
- subq_12.account_id__customer_id__customer_name
- , SUM(subq_12.txn_count) AS txn_count
+ subq_16.account_id__customer_id__customer_name
+ , SUM(subq_16.txn_count) AS txn_count
FROM (
-- Pass Only Elements: ['txn_count', 'account_id__customer_id__customer_name']
SELECT
- subq_11.account_id__customer_id__customer_name
- , subq_11.txn_count
+ subq_15.account_id__customer_id__customer_name
+ , subq_15.txn_count
FROM (
-- Join Standard Outputs
SELECT
- subq_5.ds_partitioned__day AS ds_partitioned__day
- , subq_10.ds_partitioned__day AS account_id__ds_partitioned__day
- , subq_5.account_id AS account_id
- , subq_10.customer_id__customer_name AS account_id__customer_id__customer_name
- , subq_5.txn_count AS txn_count
+ subq_7.ds_partitioned__day AS ds_partitioned__day
+ , subq_14.ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_7.account_id AS account_id
+ , subq_14.customer_id__customer_name AS account_id__customer_id__customer_name
+ , subq_7.txn_count AS txn_count
FROM (
-- Pass Only Elements: ['txn_count', 'ds_partitioned__day', 'account_id']
SELECT
- subq_4.ds_partitioned__day
- , subq_4.account_id
- , subq_4.txn_count
+ subq_6.ds_partitioned__day
+ , subq_6.account_id
+ , subq_6.txn_count
FROM (
-- Metric Time Dimension 'ds'
SELECT
- 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.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.account_id__ds_partitioned__day
- , subq_3.account_id__ds_partitioned__week
- , subq_3.account_id__ds_partitioned__month
- , subq_3.account_id__ds_partitioned__quarter
- , subq_3.account_id__ds_partitioned__year
- , subq_3.account_id__ds_partitioned__extract_year
- , subq_3.account_id__ds_partitioned__extract_quarter
- , subq_3.account_id__ds_partitioned__extract_month
- , subq_3.account_id__ds_partitioned__extract_day
- , subq_3.account_id__ds_partitioned__extract_dow
- , subq_3.account_id__ds_partitioned__extract_doy
- , subq_3.account_id__ds__day
- , subq_3.account_id__ds__week
- , subq_3.account_id__ds__month
- , subq_3.account_id__ds__quarter
- , subq_3.account_id__ds__year
- , subq_3.account_id__ds__extract_year
- , subq_3.account_id__ds__extract_quarter
- , subq_3.account_id__ds__extract_month
- , subq_3.account_id__ds__extract_day
- , subq_3.account_id__ds__extract_dow
- , subq_3.account_id__ds__extract_doy
- , subq_3.ds__day AS metric_time__day
- , subq_3.ds__week AS metric_time__week
- , subq_3.ds__month AS metric_time__month
- , subq_3.ds__quarter AS metric_time__quarter
- , subq_3.ds__year AS metric_time__year
- , subq_3.ds__extract_year AS metric_time__extract_year
- , subq_3.ds__extract_quarter AS metric_time__extract_quarter
- , subq_3.ds__extract_month AS metric_time__extract_month
- , subq_3.ds__extract_day AS metric_time__extract_day
- , subq_3.ds__extract_dow AS metric_time__extract_dow
- , subq_3.ds__extract_doy AS metric_time__extract_doy
- , subq_3.account_id
- , subq_3.account_month
- , subq_3.account_id__account_month
- , subq_3.txn_count
+ subq_5.ds_partitioned__day
+ , subq_5.ds_partitioned__week
+ , subq_5.ds_partitioned__month
+ , subq_5.ds_partitioned__quarter
+ , subq_5.ds_partitioned__year
+ , subq_5.ds_partitioned__extract_year
+ , subq_5.ds_partitioned__extract_quarter
+ , subq_5.ds_partitioned__extract_month
+ , subq_5.ds_partitioned__extract_day
+ , subq_5.ds_partitioned__extract_dow
+ , subq_5.ds_partitioned__extract_doy
+ , subq_5.ds__day
+ , subq_5.ds__week
+ , subq_5.ds__month
+ , subq_5.ds__quarter
+ , subq_5.ds__year
+ , subq_5.ds__extract_year
+ , subq_5.ds__extract_quarter
+ , subq_5.ds__extract_month
+ , subq_5.ds__extract_day
+ , subq_5.ds__extract_dow
+ , subq_5.ds__extract_doy
+ , subq_5.account_id__ds_partitioned__day
+ , subq_5.account_id__ds_partitioned__week
+ , subq_5.account_id__ds_partitioned__month
+ , subq_5.account_id__ds_partitioned__quarter
+ , subq_5.account_id__ds_partitioned__year
+ , subq_5.account_id__ds_partitioned__extract_year
+ , subq_5.account_id__ds_partitioned__extract_quarter
+ , subq_5.account_id__ds_partitioned__extract_month
+ , subq_5.account_id__ds_partitioned__extract_day
+ , subq_5.account_id__ds_partitioned__extract_dow
+ , subq_5.account_id__ds_partitioned__extract_doy
+ , subq_5.account_id__ds__day
+ , subq_5.account_id__ds__week
+ , subq_5.account_id__ds__month
+ , subq_5.account_id__ds__quarter
+ , subq_5.account_id__ds__year
+ , subq_5.account_id__ds__extract_year
+ , subq_5.account_id__ds__extract_quarter
+ , subq_5.account_id__ds__extract_month
+ , subq_5.account_id__ds__extract_day
+ , subq_5.account_id__ds__extract_dow
+ , subq_5.account_id__ds__extract_doy
+ , subq_5.ds__day AS metric_time__day
+ , subq_5.ds__week AS metric_time__week
+ , subq_5.ds__month AS metric_time__month
+ , subq_5.ds__quarter AS metric_time__quarter
+ , subq_5.ds__year AS metric_time__year
+ , subq_5.ds__extract_year AS metric_time__extract_year
+ , subq_5.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_5.ds__extract_month AS metric_time__extract_month
+ , subq_5.ds__extract_day AS metric_time__extract_day
+ , subq_5.ds__extract_dow AS metric_time__extract_dow
+ , subq_5.ds__extract_doy AS metric_time__extract_doy
+ , subq_5.account_id
+ , subq_5.account_month
+ , subq_5.account_id__account_month
+ , subq_5.txn_count
FROM (
-- Read Elements From Semantic Model 'account_month_txns'
SELECT
@@ -140,118 +140,199 @@ FROM (
, account_month_txns_src_22000.account_month AS account_id__account_month
, account_month_txns_src_22000.account_id
FROM ***************************.account_month_txns account_month_txns_src_22000
- ) subq_3
- ) subq_4
- ) subq_5
+ ) subq_5
+ ) subq_6
+ ) subq_7
LEFT OUTER JOIN (
-- Pass Only Elements: ['customer_id__customer_name', 'ds_partitioned__day', 'account_id']
SELECT
- subq_9.ds_partitioned__day
- , subq_9.account_id
- , subq_9.customer_id__customer_name
+ subq_13.ds_partitioned__day
+ , subq_13.account_id
+ , subq_13.customer_id__customer_name
FROM (
-- Join Standard Outputs
SELECT
- subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.account_id__ds_partitioned__day AS account_id__ds_partitioned__day
- , subq_6.account_id__ds_partitioned__week AS account_id__ds_partitioned__week
- , subq_6.account_id__ds_partitioned__month AS account_id__ds_partitioned__month
- , subq_6.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter
- , subq_6.account_id__ds_partitioned__year AS account_id__ds_partitioned__year
- , subq_6.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year
- , subq_6.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter
- , subq_6.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month
- , subq_6.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day
- , subq_6.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow
- , subq_6.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy
- , subq_6.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day
- , subq_6.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week
- , subq_6.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month
- , subq_6.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter
- , subq_6.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year
- , subq_6.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year
- , subq_6.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter
- , subq_6.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month
- , subq_6.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day
- , subq_6.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow
- , subq_6.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy
- , subq_8.ds_partitioned__day AS customer_id__ds_partitioned__day
- , subq_8.ds_partitioned__week AS customer_id__ds_partitioned__week
- , subq_8.ds_partitioned__month AS customer_id__ds_partitioned__month
- , subq_8.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter
- , subq_8.ds_partitioned__year AS customer_id__ds_partitioned__year
- , subq_8.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year
- , subq_8.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter
- , subq_8.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month
- , subq_8.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day
- , subq_8.ds_partitioned__extract_dow AS customer_id__ds_partitioned__extract_dow
- , subq_8.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy
- , subq_6.account_id AS account_id
- , subq_6.customer_id AS customer_id
- , subq_6.account_id__customer_id AS account_id__customer_id
- , subq_6.bridge_account__account_id AS bridge_account__account_id
- , subq_6.bridge_account__customer_id AS bridge_account__customer_id
- , subq_6.extra_dim AS extra_dim
- , subq_6.account_id__extra_dim AS account_id__extra_dim
- , subq_6.bridge_account__extra_dim AS bridge_account__extra_dim
- , subq_8.customer_name AS customer_id__customer_name
- , subq_8.customer_atomic_weight AS customer_id__customer_atomic_weight
+ subq_9.ds_partitioned__day AS ds_partitioned__day
+ , subq_9.ds_partitioned__week AS ds_partitioned__week
+ , subq_9.ds_partitioned__month AS ds_partitioned__month
+ , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_9.ds_partitioned__year AS ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_9.account_id__ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_9.account_id__ds_partitioned__week AS account_id__ds_partitioned__week
+ , subq_9.account_id__ds_partitioned__month AS account_id__ds_partitioned__month
+ , subq_9.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter
+ , subq_9.account_id__ds_partitioned__year AS account_id__ds_partitioned__year
+ , subq_9.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year
+ , subq_9.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter
+ , subq_9.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month
+ , subq_9.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day
+ , subq_9.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow
+ , subq_9.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy
+ , subq_9.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day
+ , subq_9.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week
+ , subq_9.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month
+ , subq_9.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter
+ , subq_9.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year
+ , subq_9.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year
+ , subq_9.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter
+ , subq_9.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month
+ , subq_9.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day
+ , subq_9.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow
+ , subq_9.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy
+ , subq_9.metric_time__day AS metric_time__day
+ , subq_9.metric_time__week AS metric_time__week
+ , subq_9.metric_time__month AS metric_time__month
+ , subq_9.metric_time__quarter AS metric_time__quarter
+ , subq_9.metric_time__year AS metric_time__year
+ , subq_9.metric_time__extract_year AS metric_time__extract_year
+ , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_9.metric_time__extract_month AS metric_time__extract_month
+ , subq_9.metric_time__extract_day AS metric_time__extract_day
+ , subq_9.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_9.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_12.ds_partitioned__day AS customer_id__ds_partitioned__day
+ , subq_12.ds_partitioned__week AS customer_id__ds_partitioned__week
+ , subq_12.ds_partitioned__month AS customer_id__ds_partitioned__month
+ , subq_12.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter
+ , subq_12.ds_partitioned__year AS customer_id__ds_partitioned__year
+ , subq_12.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year
+ , subq_12.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter
+ , subq_12.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month
+ , subq_12.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day
+ , subq_12.ds_partitioned__extract_dow AS customer_id__ds_partitioned__extract_dow
+ , subq_12.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy
+ , subq_12.metric_time__day AS customer_id__metric_time__day
+ , subq_12.metric_time__week AS customer_id__metric_time__week
+ , subq_12.metric_time__month AS customer_id__metric_time__month
+ , subq_12.metric_time__quarter AS customer_id__metric_time__quarter
+ , subq_12.metric_time__year AS customer_id__metric_time__year
+ , subq_12.metric_time__extract_year AS customer_id__metric_time__extract_year
+ , subq_12.metric_time__extract_quarter AS customer_id__metric_time__extract_quarter
+ , subq_12.metric_time__extract_month AS customer_id__metric_time__extract_month
+ , subq_12.metric_time__extract_day AS customer_id__metric_time__extract_day
+ , subq_12.metric_time__extract_dow AS customer_id__metric_time__extract_dow
+ , subq_12.metric_time__extract_doy AS customer_id__metric_time__extract_doy
+ , subq_9.account_id AS account_id
+ , subq_9.customer_id AS customer_id
+ , subq_9.account_id__customer_id AS account_id__customer_id
+ , subq_9.bridge_account__account_id AS bridge_account__account_id
+ , subq_9.bridge_account__customer_id AS bridge_account__customer_id
+ , subq_9.extra_dim AS extra_dim
+ , subq_9.account_id__extra_dim AS account_id__extra_dim
+ , subq_9.bridge_account__extra_dim AS bridge_account__extra_dim
+ , subq_12.customer_name AS customer_id__customer_name
+ , subq_12.customer_atomic_weight AS customer_id__customer_atomic_weight
+ , subq_9.account_customer_combos AS account_customer_combos
FROM (
- -- Read Elements From Semantic Model 'bridge_table'
+ -- Metric Time Dimension 'ds_partitioned'
SELECT
- bridge_table_src_22000.extra_dim
- , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
- , bridge_table_src_22000.extra_dim AS account_id__extra_dim
- , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
- , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
- , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
- , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
- , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
- , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
- , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
- , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim
- , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__day
- , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__week
- , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__month
- , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__quarter
- , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__year
- , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month
- , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy
- , bridge_table_src_22000.account_id
- , bridge_table_src_22000.customer_id
- , bridge_table_src_22000.customer_id AS account_id__customer_id
- , bridge_table_src_22000.account_id AS bridge_account__account_id
- , bridge_table_src_22000.customer_id AS bridge_account__customer_id
- FROM ***************************.bridge_table bridge_table_src_22000
- ) subq_6
+ subq_8.ds_partitioned__day
+ , subq_8.ds_partitioned__week
+ , subq_8.ds_partitioned__month
+ , subq_8.ds_partitioned__quarter
+ , subq_8.ds_partitioned__year
+ , subq_8.ds_partitioned__extract_year
+ , subq_8.ds_partitioned__extract_quarter
+ , subq_8.ds_partitioned__extract_month
+ , subq_8.ds_partitioned__extract_day
+ , subq_8.ds_partitioned__extract_dow
+ , subq_8.ds_partitioned__extract_doy
+ , subq_8.account_id__ds_partitioned__day
+ , subq_8.account_id__ds_partitioned__week
+ , subq_8.account_id__ds_partitioned__month
+ , subq_8.account_id__ds_partitioned__quarter
+ , subq_8.account_id__ds_partitioned__year
+ , subq_8.account_id__ds_partitioned__extract_year
+ , subq_8.account_id__ds_partitioned__extract_quarter
+ , subq_8.account_id__ds_partitioned__extract_month
+ , subq_8.account_id__ds_partitioned__extract_day
+ , subq_8.account_id__ds_partitioned__extract_dow
+ , subq_8.account_id__ds_partitioned__extract_doy
+ , subq_8.bridge_account__ds_partitioned__day
+ , subq_8.bridge_account__ds_partitioned__week
+ , subq_8.bridge_account__ds_partitioned__month
+ , subq_8.bridge_account__ds_partitioned__quarter
+ , subq_8.bridge_account__ds_partitioned__year
+ , subq_8.bridge_account__ds_partitioned__extract_year
+ , subq_8.bridge_account__ds_partitioned__extract_quarter
+ , subq_8.bridge_account__ds_partitioned__extract_month
+ , subq_8.bridge_account__ds_partitioned__extract_day
+ , subq_8.bridge_account__ds_partitioned__extract_dow
+ , subq_8.bridge_account__ds_partitioned__extract_doy
+ , subq_8.ds_partitioned__day AS metric_time__day
+ , subq_8.ds_partitioned__week AS metric_time__week
+ , subq_8.ds_partitioned__month AS metric_time__month
+ , subq_8.ds_partitioned__quarter AS metric_time__quarter
+ , subq_8.ds_partitioned__year AS metric_time__year
+ , subq_8.ds_partitioned__extract_year AS metric_time__extract_year
+ , subq_8.ds_partitioned__extract_quarter AS metric_time__extract_quarter
+ , subq_8.ds_partitioned__extract_month AS metric_time__extract_month
+ , subq_8.ds_partitioned__extract_day AS metric_time__extract_day
+ , subq_8.ds_partitioned__extract_dow AS metric_time__extract_dow
+ , subq_8.ds_partitioned__extract_doy AS metric_time__extract_doy
+ , subq_8.account_id
+ , subq_8.customer_id
+ , subq_8.account_id__customer_id
+ , subq_8.bridge_account__account_id
+ , subq_8.bridge_account__customer_id
+ , subq_8.extra_dim
+ , subq_8.account_id__extra_dim
+ , subq_8.bridge_account__extra_dim
+ , subq_8.account_customer_combos
+ FROM (
+ -- Read Elements From Semantic Model 'bridge_table'
+ SELECT
+ account_id || customer_id AS account_customer_combos
+ , bridge_table_src_22000.extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(isodow FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS account_id__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
+ , EXTRACT(isodow FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_day
+ , EXTRACT(isodow FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy
+ , bridge_table_src_22000.account_id
+ , bridge_table_src_22000.customer_id
+ , bridge_table_src_22000.customer_id AS account_id__customer_id
+ , bridge_table_src_22000.account_id AS bridge_account__account_id
+ , bridge_table_src_22000.customer_id AS bridge_account__customer_id
+ FROM ***************************.bridge_table bridge_table_src_22000
+ ) subq_8
+ ) subq_9
LEFT OUTER JOIN (
-- Pass Only Elements: [
-- 'customer_name',
@@ -280,85 +361,151 @@ FROM (
-- 'customer_id__ds_partitioned__extract_day',
-- 'customer_id__ds_partitioned__extract_dow',
-- 'customer_id__ds_partitioned__extract_doy',
+ -- 'metric_time__day',
+ -- 'metric_time__week',
+ -- 'metric_time__month',
+ -- 'metric_time__quarter',
+ -- 'metric_time__year',
+ -- 'metric_time__extract_year',
+ -- 'metric_time__extract_quarter',
+ -- 'metric_time__extract_month',
+ -- 'metric_time__extract_day',
+ -- 'metric_time__extract_dow',
+ -- 'metric_time__extract_doy',
-- 'customer_id',
-- ]
SELECT
- subq_7.ds_partitioned__day
- , subq_7.ds_partitioned__week
- , subq_7.ds_partitioned__month
- , subq_7.ds_partitioned__quarter
- , subq_7.ds_partitioned__year
- , subq_7.ds_partitioned__extract_year
- , subq_7.ds_partitioned__extract_quarter
- , subq_7.ds_partitioned__extract_month
- , subq_7.ds_partitioned__extract_day
- , subq_7.ds_partitioned__extract_dow
- , subq_7.ds_partitioned__extract_doy
- , subq_7.customer_id__ds_partitioned__day
- , subq_7.customer_id__ds_partitioned__week
- , subq_7.customer_id__ds_partitioned__month
- , subq_7.customer_id__ds_partitioned__quarter
- , subq_7.customer_id__ds_partitioned__year
- , subq_7.customer_id__ds_partitioned__extract_year
- , subq_7.customer_id__ds_partitioned__extract_quarter
- , subq_7.customer_id__ds_partitioned__extract_month
- , subq_7.customer_id__ds_partitioned__extract_day
- , subq_7.customer_id__ds_partitioned__extract_dow
- , subq_7.customer_id__ds_partitioned__extract_doy
- , subq_7.customer_id
- , subq_7.customer_name
- , subq_7.customer_atomic_weight
- , subq_7.customer_id__customer_name
- , subq_7.customer_id__customer_atomic_weight
+ subq_11.ds_partitioned__day
+ , subq_11.ds_partitioned__week
+ , subq_11.ds_partitioned__month
+ , subq_11.ds_partitioned__quarter
+ , subq_11.ds_partitioned__year
+ , subq_11.ds_partitioned__extract_year
+ , subq_11.ds_partitioned__extract_quarter
+ , subq_11.ds_partitioned__extract_month
+ , subq_11.ds_partitioned__extract_day
+ , subq_11.ds_partitioned__extract_dow
+ , subq_11.ds_partitioned__extract_doy
+ , subq_11.customer_id__ds_partitioned__day
+ , subq_11.customer_id__ds_partitioned__week
+ , subq_11.customer_id__ds_partitioned__month
+ , subq_11.customer_id__ds_partitioned__quarter
+ , subq_11.customer_id__ds_partitioned__year
+ , subq_11.customer_id__ds_partitioned__extract_year
+ , subq_11.customer_id__ds_partitioned__extract_quarter
+ , subq_11.customer_id__ds_partitioned__extract_month
+ , subq_11.customer_id__ds_partitioned__extract_day
+ , subq_11.customer_id__ds_partitioned__extract_dow
+ , subq_11.customer_id__ds_partitioned__extract_doy
+ , subq_11.metric_time__day
+ , subq_11.metric_time__week
+ , subq_11.metric_time__month
+ , subq_11.metric_time__quarter
+ , subq_11.metric_time__year
+ , subq_11.metric_time__extract_year
+ , subq_11.metric_time__extract_quarter
+ , subq_11.metric_time__extract_month
+ , subq_11.metric_time__extract_day
+ , subq_11.metric_time__extract_dow
+ , subq_11.metric_time__extract_doy
+ , subq_11.customer_id
+ , subq_11.customer_name
+ , subq_11.customer_atomic_weight
+ , subq_11.customer_id__customer_name
+ , subq_11.customer_id__customer_atomic_weight
FROM (
- -- Read Elements From Semantic Model 'customer_table'
+ -- Metric Time Dimension 'ds_partitioned'
SELECT
- customer_table_src_22000.customer_name
- , customer_table_src_22000.customer_atomic_weight
- , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
- , customer_table_src_22000.customer_name AS customer_id__customer_name
- , customer_table_src_22000.customer_atomic_weight AS customer_id__customer_atomic_weight
- , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__day
- , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__week
- , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__month
- , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__quarter
- , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__year
- , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_year
- , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter
- , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_month
- , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_day
- , EXTRACT(isodow FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_dow
- , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_doy
- , customer_table_src_22000.customer_id
- FROM ***************************.customer_table customer_table_src_22000
- ) subq_7
- ) subq_8
+ subq_10.ds_partitioned__day
+ , subq_10.ds_partitioned__week
+ , subq_10.ds_partitioned__month
+ , subq_10.ds_partitioned__quarter
+ , subq_10.ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy
+ , subq_10.customer_id__ds_partitioned__day
+ , subq_10.customer_id__ds_partitioned__week
+ , subq_10.customer_id__ds_partitioned__month
+ , subq_10.customer_id__ds_partitioned__quarter
+ , subq_10.customer_id__ds_partitioned__year
+ , subq_10.customer_id__ds_partitioned__extract_year
+ , subq_10.customer_id__ds_partitioned__extract_quarter
+ , subq_10.customer_id__ds_partitioned__extract_month
+ , subq_10.customer_id__ds_partitioned__extract_day
+ , subq_10.customer_id__ds_partitioned__extract_dow
+ , subq_10.customer_id__ds_partitioned__extract_doy
+ , subq_10.ds_partitioned__day AS metric_time__day
+ , subq_10.ds_partitioned__week AS metric_time__week
+ , subq_10.ds_partitioned__month AS metric_time__month
+ , subq_10.ds_partitioned__quarter AS metric_time__quarter
+ , subq_10.ds_partitioned__year AS metric_time__year
+ , subq_10.ds_partitioned__extract_year AS metric_time__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS metric_time__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS metric_time__extract_month
+ , subq_10.ds_partitioned__extract_day AS metric_time__extract_day
+ , subq_10.ds_partitioned__extract_dow AS metric_time__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS metric_time__extract_doy
+ , subq_10.customer_id
+ , subq_10.customer_name
+ , subq_10.customer_atomic_weight
+ , subq_10.customer_id__customer_name
+ , subq_10.customer_id__customer_atomic_weight
+ , subq_10.customers
+ FROM (
+ -- Read Elements From Semantic Model 'customer_table'
+ SELECT
+ 1 AS customers
+ , customer_table_src_22000.customer_name
+ , customer_table_src_22000.customer_atomic_weight
+ , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(isodow FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , customer_table_src_22000.customer_name AS customer_id__customer_name
+ , customer_table_src_22000.customer_atomic_weight AS customer_id__customer_atomic_weight
+ , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__day
+ , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__week
+ , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__year
+ , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_day
+ , EXTRACT(isodow FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_doy
+ , customer_table_src_22000.customer_id
+ FROM ***************************.customer_table customer_table_src_22000
+ ) subq_10
+ ) subq_11
+ ) subq_12
ON
(
- subq_6.customer_id = subq_8.customer_id
+ subq_9.customer_id = subq_12.customer_id
) AND (
- subq_6.ds_partitioned__day = subq_8.ds_partitioned__day
+ subq_9.ds_partitioned__day = subq_12.ds_partitioned__day
)
- ) subq_9
- ) subq_10
+ ) subq_13
+ ) subq_14
ON
(
- subq_5.account_id = subq_10.account_id
+ subq_7.account_id = subq_14.account_id
) AND (
- subq_5.ds_partitioned__day = subq_10.ds_partitioned__day
+ subq_7.ds_partitioned__day = subq_14.ds_partitioned__day
)
- ) subq_11
- ) subq_12
+ ) subq_15
+ ) subq_16
GROUP BY
- subq_12.account_id__customer_id__customer_name
-) subq_13
+ subq_16.account_id__customer_id__customer_name
+) subq_17
diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multihop_node__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multihop_node__plan0_optimized.sql
index 3081559380..ee22b130fc 100644
--- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multihop_node__plan0_optimized.sql
+++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Postgres/test_multihop_node__plan0_optimized.sql
@@ -3,7 +3,7 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_21.customer_id__customer_name AS account_id__customer_id__customer_name
+ subq_27.customer_id__customer_name AS account_id__customer_id__customer_name
, SUM(account_month_txns_src_22000.txn_count) AS txn_count
FROM ***************************.account_month_txns account_month_txns_src_22000
LEFT OUTER JOIN (
@@ -22,12 +22,12 @@ LEFT OUTER JOIN (
) AND (
DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) = DATE_TRUNC('day', customer_table_src_22000.ds_partitioned)
)
-) subq_21
+) subq_27
ON
(
- account_month_txns_src_22000.account_id = subq_21.account_id
+ account_month_txns_src_22000.account_id = subq_27.account_id
) AND (
- DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_21.ds_partitioned__day
+ DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_27.ds_partitioned__day
)
GROUP BY
- subq_21.customer_id__customer_name
+ subq_27.customer_id__customer_name
diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multihop_node__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multihop_node__plan0.sql
index 9ec25ff75b..d6df2f60b8 100644
--- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multihop_node__plan0.sql
+++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multihop_node__plan0.sql
@@ -1,93 +1,93 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.account_id__customer_id__customer_name
- , subq_13.txn_count
+ subq_17.account_id__customer_id__customer_name
+ , subq_17.txn_count
FROM (
-- Aggregate Measures
SELECT
- subq_12.account_id__customer_id__customer_name
- , SUM(subq_12.txn_count) AS txn_count
+ subq_16.account_id__customer_id__customer_name
+ , SUM(subq_16.txn_count) AS txn_count
FROM (
-- Pass Only Elements: ['txn_count', 'account_id__customer_id__customer_name']
SELECT
- subq_11.account_id__customer_id__customer_name
- , subq_11.txn_count
+ subq_15.account_id__customer_id__customer_name
+ , subq_15.txn_count
FROM (
-- Join Standard Outputs
SELECT
- subq_5.ds_partitioned__day AS ds_partitioned__day
- , subq_10.ds_partitioned__day AS account_id__ds_partitioned__day
- , subq_5.account_id AS account_id
- , subq_10.customer_id__customer_name AS account_id__customer_id__customer_name
- , subq_5.txn_count AS txn_count
+ subq_7.ds_partitioned__day AS ds_partitioned__day
+ , subq_14.ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_7.account_id AS account_id
+ , subq_14.customer_id__customer_name AS account_id__customer_id__customer_name
+ , subq_7.txn_count AS txn_count
FROM (
-- Pass Only Elements: ['txn_count', 'ds_partitioned__day', 'account_id']
SELECT
- subq_4.ds_partitioned__day
- , subq_4.account_id
- , subq_4.txn_count
+ subq_6.ds_partitioned__day
+ , subq_6.account_id
+ , subq_6.txn_count
FROM (
-- Metric Time Dimension 'ds'
SELECT
- 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.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.account_id__ds_partitioned__day
- , subq_3.account_id__ds_partitioned__week
- , subq_3.account_id__ds_partitioned__month
- , subq_3.account_id__ds_partitioned__quarter
- , subq_3.account_id__ds_partitioned__year
- , subq_3.account_id__ds_partitioned__extract_year
- , subq_3.account_id__ds_partitioned__extract_quarter
- , subq_3.account_id__ds_partitioned__extract_month
- , subq_3.account_id__ds_partitioned__extract_day
- , subq_3.account_id__ds_partitioned__extract_dow
- , subq_3.account_id__ds_partitioned__extract_doy
- , subq_3.account_id__ds__day
- , subq_3.account_id__ds__week
- , subq_3.account_id__ds__month
- , subq_3.account_id__ds__quarter
- , subq_3.account_id__ds__year
- , subq_3.account_id__ds__extract_year
- , subq_3.account_id__ds__extract_quarter
- , subq_3.account_id__ds__extract_month
- , subq_3.account_id__ds__extract_day
- , subq_3.account_id__ds__extract_dow
- , subq_3.account_id__ds__extract_doy
- , subq_3.ds__day AS metric_time__day
- , subq_3.ds__week AS metric_time__week
- , subq_3.ds__month AS metric_time__month
- , subq_3.ds__quarter AS metric_time__quarter
- , subq_3.ds__year AS metric_time__year
- , subq_3.ds__extract_year AS metric_time__extract_year
- , subq_3.ds__extract_quarter AS metric_time__extract_quarter
- , subq_3.ds__extract_month AS metric_time__extract_month
- , subq_3.ds__extract_day AS metric_time__extract_day
- , subq_3.ds__extract_dow AS metric_time__extract_dow
- , subq_3.ds__extract_doy AS metric_time__extract_doy
- , subq_3.account_id
- , subq_3.account_month
- , subq_3.account_id__account_month
- , subq_3.txn_count
+ subq_5.ds_partitioned__day
+ , subq_5.ds_partitioned__week
+ , subq_5.ds_partitioned__month
+ , subq_5.ds_partitioned__quarter
+ , subq_5.ds_partitioned__year
+ , subq_5.ds_partitioned__extract_year
+ , subq_5.ds_partitioned__extract_quarter
+ , subq_5.ds_partitioned__extract_month
+ , subq_5.ds_partitioned__extract_day
+ , subq_5.ds_partitioned__extract_dow
+ , subq_5.ds_partitioned__extract_doy
+ , subq_5.ds__day
+ , subq_5.ds__week
+ , subq_5.ds__month
+ , subq_5.ds__quarter
+ , subq_5.ds__year
+ , subq_5.ds__extract_year
+ , subq_5.ds__extract_quarter
+ , subq_5.ds__extract_month
+ , subq_5.ds__extract_day
+ , subq_5.ds__extract_dow
+ , subq_5.ds__extract_doy
+ , subq_5.account_id__ds_partitioned__day
+ , subq_5.account_id__ds_partitioned__week
+ , subq_5.account_id__ds_partitioned__month
+ , subq_5.account_id__ds_partitioned__quarter
+ , subq_5.account_id__ds_partitioned__year
+ , subq_5.account_id__ds_partitioned__extract_year
+ , subq_5.account_id__ds_partitioned__extract_quarter
+ , subq_5.account_id__ds_partitioned__extract_month
+ , subq_5.account_id__ds_partitioned__extract_day
+ , subq_5.account_id__ds_partitioned__extract_dow
+ , subq_5.account_id__ds_partitioned__extract_doy
+ , subq_5.account_id__ds__day
+ , subq_5.account_id__ds__week
+ , subq_5.account_id__ds__month
+ , subq_5.account_id__ds__quarter
+ , subq_5.account_id__ds__year
+ , subq_5.account_id__ds__extract_year
+ , subq_5.account_id__ds__extract_quarter
+ , subq_5.account_id__ds__extract_month
+ , subq_5.account_id__ds__extract_day
+ , subq_5.account_id__ds__extract_dow
+ , subq_5.account_id__ds__extract_doy
+ , subq_5.ds__day AS metric_time__day
+ , subq_5.ds__week AS metric_time__week
+ , subq_5.ds__month AS metric_time__month
+ , subq_5.ds__quarter AS metric_time__quarter
+ , subq_5.ds__year AS metric_time__year
+ , subq_5.ds__extract_year AS metric_time__extract_year
+ , subq_5.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_5.ds__extract_month AS metric_time__extract_month
+ , subq_5.ds__extract_day AS metric_time__extract_day
+ , subq_5.ds__extract_dow AS metric_time__extract_dow
+ , subq_5.ds__extract_doy AS metric_time__extract_doy
+ , subq_5.account_id
+ , subq_5.account_month
+ , subq_5.account_id__account_month
+ , subq_5.txn_count
FROM (
-- Read Elements From Semantic Model 'account_month_txns'
SELECT
@@ -140,118 +140,199 @@ FROM (
, account_month_txns_src_22000.account_month AS account_id__account_month
, account_month_txns_src_22000.account_id
FROM ***************************.account_month_txns account_month_txns_src_22000
- ) subq_3
- ) subq_4
- ) subq_5
+ ) subq_5
+ ) subq_6
+ ) subq_7
LEFT OUTER JOIN (
-- Pass Only Elements: ['customer_id__customer_name', 'ds_partitioned__day', 'account_id']
SELECT
- subq_9.ds_partitioned__day
- , subq_9.account_id
- , subq_9.customer_id__customer_name
+ subq_13.ds_partitioned__day
+ , subq_13.account_id
+ , subq_13.customer_id__customer_name
FROM (
-- Join Standard Outputs
SELECT
- subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.account_id__ds_partitioned__day AS account_id__ds_partitioned__day
- , subq_6.account_id__ds_partitioned__week AS account_id__ds_partitioned__week
- , subq_6.account_id__ds_partitioned__month AS account_id__ds_partitioned__month
- , subq_6.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter
- , subq_6.account_id__ds_partitioned__year AS account_id__ds_partitioned__year
- , subq_6.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year
- , subq_6.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter
- , subq_6.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month
- , subq_6.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day
- , subq_6.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow
- , subq_6.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy
- , subq_6.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day
- , subq_6.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week
- , subq_6.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month
- , subq_6.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter
- , subq_6.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year
- , subq_6.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year
- , subq_6.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter
- , subq_6.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month
- , subq_6.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day
- , subq_6.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow
- , subq_6.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy
- , subq_8.ds_partitioned__day AS customer_id__ds_partitioned__day
- , subq_8.ds_partitioned__week AS customer_id__ds_partitioned__week
- , subq_8.ds_partitioned__month AS customer_id__ds_partitioned__month
- , subq_8.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter
- , subq_8.ds_partitioned__year AS customer_id__ds_partitioned__year
- , subq_8.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year
- , subq_8.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter
- , subq_8.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month
- , subq_8.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day
- , subq_8.ds_partitioned__extract_dow AS customer_id__ds_partitioned__extract_dow
- , subq_8.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy
- , subq_6.account_id AS account_id
- , subq_6.customer_id AS customer_id
- , subq_6.account_id__customer_id AS account_id__customer_id
- , subq_6.bridge_account__account_id AS bridge_account__account_id
- , subq_6.bridge_account__customer_id AS bridge_account__customer_id
- , subq_6.extra_dim AS extra_dim
- , subq_6.account_id__extra_dim AS account_id__extra_dim
- , subq_6.bridge_account__extra_dim AS bridge_account__extra_dim
- , subq_8.customer_name AS customer_id__customer_name
- , subq_8.customer_atomic_weight AS customer_id__customer_atomic_weight
+ subq_9.ds_partitioned__day AS ds_partitioned__day
+ , subq_9.ds_partitioned__week AS ds_partitioned__week
+ , subq_9.ds_partitioned__month AS ds_partitioned__month
+ , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_9.ds_partitioned__year AS ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_9.account_id__ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_9.account_id__ds_partitioned__week AS account_id__ds_partitioned__week
+ , subq_9.account_id__ds_partitioned__month AS account_id__ds_partitioned__month
+ , subq_9.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter
+ , subq_9.account_id__ds_partitioned__year AS account_id__ds_partitioned__year
+ , subq_9.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year
+ , subq_9.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter
+ , subq_9.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month
+ , subq_9.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day
+ , subq_9.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow
+ , subq_9.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy
+ , subq_9.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day
+ , subq_9.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week
+ , subq_9.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month
+ , subq_9.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter
+ , subq_9.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year
+ , subq_9.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year
+ , subq_9.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter
+ , subq_9.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month
+ , subq_9.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day
+ , subq_9.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow
+ , subq_9.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy
+ , subq_9.metric_time__day AS metric_time__day
+ , subq_9.metric_time__week AS metric_time__week
+ , subq_9.metric_time__month AS metric_time__month
+ , subq_9.metric_time__quarter AS metric_time__quarter
+ , subq_9.metric_time__year AS metric_time__year
+ , subq_9.metric_time__extract_year AS metric_time__extract_year
+ , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_9.metric_time__extract_month AS metric_time__extract_month
+ , subq_9.metric_time__extract_day AS metric_time__extract_day
+ , subq_9.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_9.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_12.ds_partitioned__day AS customer_id__ds_partitioned__day
+ , subq_12.ds_partitioned__week AS customer_id__ds_partitioned__week
+ , subq_12.ds_partitioned__month AS customer_id__ds_partitioned__month
+ , subq_12.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter
+ , subq_12.ds_partitioned__year AS customer_id__ds_partitioned__year
+ , subq_12.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year
+ , subq_12.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter
+ , subq_12.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month
+ , subq_12.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day
+ , subq_12.ds_partitioned__extract_dow AS customer_id__ds_partitioned__extract_dow
+ , subq_12.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy
+ , subq_12.metric_time__day AS customer_id__metric_time__day
+ , subq_12.metric_time__week AS customer_id__metric_time__week
+ , subq_12.metric_time__month AS customer_id__metric_time__month
+ , subq_12.metric_time__quarter AS customer_id__metric_time__quarter
+ , subq_12.metric_time__year AS customer_id__metric_time__year
+ , subq_12.metric_time__extract_year AS customer_id__metric_time__extract_year
+ , subq_12.metric_time__extract_quarter AS customer_id__metric_time__extract_quarter
+ , subq_12.metric_time__extract_month AS customer_id__metric_time__extract_month
+ , subq_12.metric_time__extract_day AS customer_id__metric_time__extract_day
+ , subq_12.metric_time__extract_dow AS customer_id__metric_time__extract_dow
+ , subq_12.metric_time__extract_doy AS customer_id__metric_time__extract_doy
+ , subq_9.account_id AS account_id
+ , subq_9.customer_id AS customer_id
+ , subq_9.account_id__customer_id AS account_id__customer_id
+ , subq_9.bridge_account__account_id AS bridge_account__account_id
+ , subq_9.bridge_account__customer_id AS bridge_account__customer_id
+ , subq_9.extra_dim AS extra_dim
+ , subq_9.account_id__extra_dim AS account_id__extra_dim
+ , subq_9.bridge_account__extra_dim AS bridge_account__extra_dim
+ , subq_12.customer_name AS customer_id__customer_name
+ , subq_12.customer_atomic_weight AS customer_id__customer_atomic_weight
+ , subq_9.account_customer_combos AS account_customer_combos
FROM (
- -- Read Elements From Semantic Model 'bridge_table'
+ -- Metric Time Dimension 'ds_partitioned'
SELECT
- bridge_table_src_22000.extra_dim
- , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
- , bridge_table_src_22000.extra_dim AS account_id__extra_dim
- , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
- , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
- , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
- , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
- , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
- , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
- , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) END AS account_id__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
- , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim
- , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__day
- , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__week
- , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__month
- , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__quarter
- , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__year
- , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month
- , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) END AS bridge_account__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy
- , bridge_table_src_22000.account_id
- , bridge_table_src_22000.customer_id
- , bridge_table_src_22000.customer_id AS account_id__customer_id
- , bridge_table_src_22000.account_id AS bridge_account__account_id
- , bridge_table_src_22000.customer_id AS bridge_account__customer_id
- FROM ***************************.bridge_table bridge_table_src_22000
- ) subq_6
+ subq_8.ds_partitioned__day
+ , subq_8.ds_partitioned__week
+ , subq_8.ds_partitioned__month
+ , subq_8.ds_partitioned__quarter
+ , subq_8.ds_partitioned__year
+ , subq_8.ds_partitioned__extract_year
+ , subq_8.ds_partitioned__extract_quarter
+ , subq_8.ds_partitioned__extract_month
+ , subq_8.ds_partitioned__extract_day
+ , subq_8.ds_partitioned__extract_dow
+ , subq_8.ds_partitioned__extract_doy
+ , subq_8.account_id__ds_partitioned__day
+ , subq_8.account_id__ds_partitioned__week
+ , subq_8.account_id__ds_partitioned__month
+ , subq_8.account_id__ds_partitioned__quarter
+ , subq_8.account_id__ds_partitioned__year
+ , subq_8.account_id__ds_partitioned__extract_year
+ , subq_8.account_id__ds_partitioned__extract_quarter
+ , subq_8.account_id__ds_partitioned__extract_month
+ , subq_8.account_id__ds_partitioned__extract_day
+ , subq_8.account_id__ds_partitioned__extract_dow
+ , subq_8.account_id__ds_partitioned__extract_doy
+ , subq_8.bridge_account__ds_partitioned__day
+ , subq_8.bridge_account__ds_partitioned__week
+ , subq_8.bridge_account__ds_partitioned__month
+ , subq_8.bridge_account__ds_partitioned__quarter
+ , subq_8.bridge_account__ds_partitioned__year
+ , subq_8.bridge_account__ds_partitioned__extract_year
+ , subq_8.bridge_account__ds_partitioned__extract_quarter
+ , subq_8.bridge_account__ds_partitioned__extract_month
+ , subq_8.bridge_account__ds_partitioned__extract_day
+ , subq_8.bridge_account__ds_partitioned__extract_dow
+ , subq_8.bridge_account__ds_partitioned__extract_doy
+ , subq_8.ds_partitioned__day AS metric_time__day
+ , subq_8.ds_partitioned__week AS metric_time__week
+ , subq_8.ds_partitioned__month AS metric_time__month
+ , subq_8.ds_partitioned__quarter AS metric_time__quarter
+ , subq_8.ds_partitioned__year AS metric_time__year
+ , subq_8.ds_partitioned__extract_year AS metric_time__extract_year
+ , subq_8.ds_partitioned__extract_quarter AS metric_time__extract_quarter
+ , subq_8.ds_partitioned__extract_month AS metric_time__extract_month
+ , subq_8.ds_partitioned__extract_day AS metric_time__extract_day
+ , subq_8.ds_partitioned__extract_dow AS metric_time__extract_dow
+ , subq_8.ds_partitioned__extract_doy AS metric_time__extract_doy
+ , subq_8.account_id
+ , subq_8.customer_id
+ , subq_8.account_id__customer_id
+ , subq_8.bridge_account__account_id
+ , subq_8.bridge_account__customer_id
+ , subq_8.extra_dim
+ , subq_8.account_id__extra_dim
+ , subq_8.bridge_account__extra_dim
+ , subq_8.account_customer_combos
+ FROM (
+ -- Read Elements From Semantic Model 'bridge_table'
+ SELECT
+ account_id || customer_id AS account_customer_combos
+ , bridge_table_src_22000.extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , CASE WHEN EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS account_id__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
+ , CASE WHEN EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) END AS account_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_day
+ , CASE WHEN EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bridge_table_src_22000.ds_partitioned) END AS bridge_account__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy
+ , bridge_table_src_22000.account_id
+ , bridge_table_src_22000.customer_id
+ , bridge_table_src_22000.customer_id AS account_id__customer_id
+ , bridge_table_src_22000.account_id AS bridge_account__account_id
+ , bridge_table_src_22000.customer_id AS bridge_account__customer_id
+ FROM ***************************.bridge_table bridge_table_src_22000
+ ) subq_8
+ ) subq_9
LEFT OUTER JOIN (
-- Pass Only Elements: [
-- 'customer_name',
@@ -280,85 +361,151 @@ FROM (
-- 'customer_id__ds_partitioned__extract_day',
-- 'customer_id__ds_partitioned__extract_dow',
-- 'customer_id__ds_partitioned__extract_doy',
+ -- 'metric_time__day',
+ -- 'metric_time__week',
+ -- 'metric_time__month',
+ -- 'metric_time__quarter',
+ -- 'metric_time__year',
+ -- 'metric_time__extract_year',
+ -- 'metric_time__extract_quarter',
+ -- 'metric_time__extract_month',
+ -- 'metric_time__extract_day',
+ -- 'metric_time__extract_dow',
+ -- 'metric_time__extract_doy',
-- 'customer_id',
-- ]
SELECT
- subq_7.ds_partitioned__day
- , subq_7.ds_partitioned__week
- , subq_7.ds_partitioned__month
- , subq_7.ds_partitioned__quarter
- , subq_7.ds_partitioned__year
- , subq_7.ds_partitioned__extract_year
- , subq_7.ds_partitioned__extract_quarter
- , subq_7.ds_partitioned__extract_month
- , subq_7.ds_partitioned__extract_day
- , subq_7.ds_partitioned__extract_dow
- , subq_7.ds_partitioned__extract_doy
- , subq_7.customer_id__ds_partitioned__day
- , subq_7.customer_id__ds_partitioned__week
- , subq_7.customer_id__ds_partitioned__month
- , subq_7.customer_id__ds_partitioned__quarter
- , subq_7.customer_id__ds_partitioned__year
- , subq_7.customer_id__ds_partitioned__extract_year
- , subq_7.customer_id__ds_partitioned__extract_quarter
- , subq_7.customer_id__ds_partitioned__extract_month
- , subq_7.customer_id__ds_partitioned__extract_day
- , subq_7.customer_id__ds_partitioned__extract_dow
- , subq_7.customer_id__ds_partitioned__extract_doy
- , subq_7.customer_id
- , subq_7.customer_name
- , subq_7.customer_atomic_weight
- , subq_7.customer_id__customer_name
- , subq_7.customer_id__customer_atomic_weight
+ subq_11.ds_partitioned__day
+ , subq_11.ds_partitioned__week
+ , subq_11.ds_partitioned__month
+ , subq_11.ds_partitioned__quarter
+ , subq_11.ds_partitioned__year
+ , subq_11.ds_partitioned__extract_year
+ , subq_11.ds_partitioned__extract_quarter
+ , subq_11.ds_partitioned__extract_month
+ , subq_11.ds_partitioned__extract_day
+ , subq_11.ds_partitioned__extract_dow
+ , subq_11.ds_partitioned__extract_doy
+ , subq_11.customer_id__ds_partitioned__day
+ , subq_11.customer_id__ds_partitioned__week
+ , subq_11.customer_id__ds_partitioned__month
+ , subq_11.customer_id__ds_partitioned__quarter
+ , subq_11.customer_id__ds_partitioned__year
+ , subq_11.customer_id__ds_partitioned__extract_year
+ , subq_11.customer_id__ds_partitioned__extract_quarter
+ , subq_11.customer_id__ds_partitioned__extract_month
+ , subq_11.customer_id__ds_partitioned__extract_day
+ , subq_11.customer_id__ds_partitioned__extract_dow
+ , subq_11.customer_id__ds_partitioned__extract_doy
+ , subq_11.metric_time__day
+ , subq_11.metric_time__week
+ , subq_11.metric_time__month
+ , subq_11.metric_time__quarter
+ , subq_11.metric_time__year
+ , subq_11.metric_time__extract_year
+ , subq_11.metric_time__extract_quarter
+ , subq_11.metric_time__extract_month
+ , subq_11.metric_time__extract_day
+ , subq_11.metric_time__extract_dow
+ , subq_11.metric_time__extract_doy
+ , subq_11.customer_id
+ , subq_11.customer_name
+ , subq_11.customer_atomic_weight
+ , subq_11.customer_id__customer_name
+ , subq_11.customer_id__customer_atomic_weight
FROM (
- -- Read Elements From Semantic Model 'customer_table'
+ -- Metric Time Dimension 'ds_partitioned'
SELECT
- customer_table_src_22000.customer_name
- , customer_table_src_22000.customer_atomic_weight
- , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM customer_table_src_22000.ds_partitioned) = 0 THEN EXTRACT(dow FROM customer_table_src_22000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM customer_table_src_22000.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
- , customer_table_src_22000.customer_name AS customer_id__customer_name
- , customer_table_src_22000.customer_atomic_weight AS customer_id__customer_atomic_weight
- , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__day
- , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__week
- , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__month
- , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__quarter
- , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__year
- , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_year
- , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter
- , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_month
- , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM customer_table_src_22000.ds_partitioned) = 0 THEN EXTRACT(dow FROM customer_table_src_22000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM customer_table_src_22000.ds_partitioned) END AS customer_id__ds_partitioned__extract_dow
- , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_doy
- , customer_table_src_22000.customer_id
- FROM ***************************.customer_table customer_table_src_22000
- ) subq_7
- ) subq_8
+ subq_10.ds_partitioned__day
+ , subq_10.ds_partitioned__week
+ , subq_10.ds_partitioned__month
+ , subq_10.ds_partitioned__quarter
+ , subq_10.ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy
+ , subq_10.customer_id__ds_partitioned__day
+ , subq_10.customer_id__ds_partitioned__week
+ , subq_10.customer_id__ds_partitioned__month
+ , subq_10.customer_id__ds_partitioned__quarter
+ , subq_10.customer_id__ds_partitioned__year
+ , subq_10.customer_id__ds_partitioned__extract_year
+ , subq_10.customer_id__ds_partitioned__extract_quarter
+ , subq_10.customer_id__ds_partitioned__extract_month
+ , subq_10.customer_id__ds_partitioned__extract_day
+ , subq_10.customer_id__ds_partitioned__extract_dow
+ , subq_10.customer_id__ds_partitioned__extract_doy
+ , subq_10.ds_partitioned__day AS metric_time__day
+ , subq_10.ds_partitioned__week AS metric_time__week
+ , subq_10.ds_partitioned__month AS metric_time__month
+ , subq_10.ds_partitioned__quarter AS metric_time__quarter
+ , subq_10.ds_partitioned__year AS metric_time__year
+ , subq_10.ds_partitioned__extract_year AS metric_time__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS metric_time__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS metric_time__extract_month
+ , subq_10.ds_partitioned__extract_day AS metric_time__extract_day
+ , subq_10.ds_partitioned__extract_dow AS metric_time__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS metric_time__extract_doy
+ , subq_10.customer_id
+ , subq_10.customer_name
+ , subq_10.customer_atomic_weight
+ , subq_10.customer_id__customer_name
+ , subq_10.customer_id__customer_atomic_weight
+ , subq_10.customers
+ FROM (
+ -- Read Elements From Semantic Model 'customer_table'
+ SELECT
+ 1 AS customers
+ , customer_table_src_22000.customer_name
+ , customer_table_src_22000.customer_atomic_weight
+ , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , CASE WHEN EXTRACT(dow FROM customer_table_src_22000.ds_partitioned) = 0 THEN EXTRACT(dow FROM customer_table_src_22000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM customer_table_src_22000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , customer_table_src_22000.customer_name AS customer_id__customer_name
+ , customer_table_src_22000.customer_atomic_weight AS customer_id__customer_atomic_weight
+ , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__day
+ , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__week
+ , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__year
+ , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_day
+ , CASE WHEN EXTRACT(dow FROM customer_table_src_22000.ds_partitioned) = 0 THEN EXTRACT(dow FROM customer_table_src_22000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM customer_table_src_22000.ds_partitioned) END AS customer_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_doy
+ , customer_table_src_22000.customer_id
+ FROM ***************************.customer_table customer_table_src_22000
+ ) subq_10
+ ) subq_11
+ ) subq_12
ON
(
- subq_6.customer_id = subq_8.customer_id
+ subq_9.customer_id = subq_12.customer_id
) AND (
- subq_6.ds_partitioned__day = subq_8.ds_partitioned__day
+ subq_9.ds_partitioned__day = subq_12.ds_partitioned__day
)
- ) subq_9
- ) subq_10
+ ) subq_13
+ ) subq_14
ON
(
- subq_5.account_id = subq_10.account_id
+ subq_7.account_id = subq_14.account_id
) AND (
- subq_5.ds_partitioned__day = subq_10.ds_partitioned__day
+ subq_7.ds_partitioned__day = subq_14.ds_partitioned__day
)
- ) subq_11
- ) subq_12
+ ) subq_15
+ ) subq_16
GROUP BY
- subq_12.account_id__customer_id__customer_name
-) subq_13
+ subq_16.account_id__customer_id__customer_name
+) subq_17
diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multihop_node__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multihop_node__plan0_optimized.sql
index 3081559380..ee22b130fc 100644
--- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multihop_node__plan0_optimized.sql
+++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Redshift/test_multihop_node__plan0_optimized.sql
@@ -3,7 +3,7 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_21.customer_id__customer_name AS account_id__customer_id__customer_name
+ subq_27.customer_id__customer_name AS account_id__customer_id__customer_name
, SUM(account_month_txns_src_22000.txn_count) AS txn_count
FROM ***************************.account_month_txns account_month_txns_src_22000
LEFT OUTER JOIN (
@@ -22,12 +22,12 @@ LEFT OUTER JOIN (
) AND (
DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) = DATE_TRUNC('day', customer_table_src_22000.ds_partitioned)
)
-) subq_21
+) subq_27
ON
(
- account_month_txns_src_22000.account_id = subq_21.account_id
+ account_month_txns_src_22000.account_id = subq_27.account_id
) AND (
- DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_21.ds_partitioned__day
+ DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_27.ds_partitioned__day
)
GROUP BY
- subq_21.customer_id__customer_name
+ subq_27.customer_id__customer_name
diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0.sql
index 596731df02..03dc99f183 100644
--- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0.sql
+++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0.sql
@@ -1,93 +1,93 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.account_id__customer_id__customer_name
- , subq_13.txn_count
+ subq_17.account_id__customer_id__customer_name
+ , subq_17.txn_count
FROM (
-- Aggregate Measures
SELECT
- subq_12.account_id__customer_id__customer_name
- , SUM(subq_12.txn_count) AS txn_count
+ subq_16.account_id__customer_id__customer_name
+ , SUM(subq_16.txn_count) AS txn_count
FROM (
-- Pass Only Elements: ['txn_count', 'account_id__customer_id__customer_name']
SELECT
- subq_11.account_id__customer_id__customer_name
- , subq_11.txn_count
+ subq_15.account_id__customer_id__customer_name
+ , subq_15.txn_count
FROM (
-- Join Standard Outputs
SELECT
- subq_5.ds_partitioned__day AS ds_partitioned__day
- , subq_10.ds_partitioned__day AS account_id__ds_partitioned__day
- , subq_5.account_id AS account_id
- , subq_10.customer_id__customer_name AS account_id__customer_id__customer_name
- , subq_5.txn_count AS txn_count
+ subq_7.ds_partitioned__day AS ds_partitioned__day
+ , subq_14.ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_7.account_id AS account_id
+ , subq_14.customer_id__customer_name AS account_id__customer_id__customer_name
+ , subq_7.txn_count AS txn_count
FROM (
-- Pass Only Elements: ['txn_count', 'ds_partitioned__day', 'account_id']
SELECT
- subq_4.ds_partitioned__day
- , subq_4.account_id
- , subq_4.txn_count
+ subq_6.ds_partitioned__day
+ , subq_6.account_id
+ , subq_6.txn_count
FROM (
-- Metric Time Dimension 'ds'
SELECT
- 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.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.account_id__ds_partitioned__day
- , subq_3.account_id__ds_partitioned__week
- , subq_3.account_id__ds_partitioned__month
- , subq_3.account_id__ds_partitioned__quarter
- , subq_3.account_id__ds_partitioned__year
- , subq_3.account_id__ds_partitioned__extract_year
- , subq_3.account_id__ds_partitioned__extract_quarter
- , subq_3.account_id__ds_partitioned__extract_month
- , subq_3.account_id__ds_partitioned__extract_day
- , subq_3.account_id__ds_partitioned__extract_dow
- , subq_3.account_id__ds_partitioned__extract_doy
- , subq_3.account_id__ds__day
- , subq_3.account_id__ds__week
- , subq_3.account_id__ds__month
- , subq_3.account_id__ds__quarter
- , subq_3.account_id__ds__year
- , subq_3.account_id__ds__extract_year
- , subq_3.account_id__ds__extract_quarter
- , subq_3.account_id__ds__extract_month
- , subq_3.account_id__ds__extract_day
- , subq_3.account_id__ds__extract_dow
- , subq_3.account_id__ds__extract_doy
- , subq_3.ds__day AS metric_time__day
- , subq_3.ds__week AS metric_time__week
- , subq_3.ds__month AS metric_time__month
- , subq_3.ds__quarter AS metric_time__quarter
- , subq_3.ds__year AS metric_time__year
- , subq_3.ds__extract_year AS metric_time__extract_year
- , subq_3.ds__extract_quarter AS metric_time__extract_quarter
- , subq_3.ds__extract_month AS metric_time__extract_month
- , subq_3.ds__extract_day AS metric_time__extract_day
- , subq_3.ds__extract_dow AS metric_time__extract_dow
- , subq_3.ds__extract_doy AS metric_time__extract_doy
- , subq_3.account_id
- , subq_3.account_month
- , subq_3.account_id__account_month
- , subq_3.txn_count
+ subq_5.ds_partitioned__day
+ , subq_5.ds_partitioned__week
+ , subq_5.ds_partitioned__month
+ , subq_5.ds_partitioned__quarter
+ , subq_5.ds_partitioned__year
+ , subq_5.ds_partitioned__extract_year
+ , subq_5.ds_partitioned__extract_quarter
+ , subq_5.ds_partitioned__extract_month
+ , subq_5.ds_partitioned__extract_day
+ , subq_5.ds_partitioned__extract_dow
+ , subq_5.ds_partitioned__extract_doy
+ , subq_5.ds__day
+ , subq_5.ds__week
+ , subq_5.ds__month
+ , subq_5.ds__quarter
+ , subq_5.ds__year
+ , subq_5.ds__extract_year
+ , subq_5.ds__extract_quarter
+ , subq_5.ds__extract_month
+ , subq_5.ds__extract_day
+ , subq_5.ds__extract_dow
+ , subq_5.ds__extract_doy
+ , subq_5.account_id__ds_partitioned__day
+ , subq_5.account_id__ds_partitioned__week
+ , subq_5.account_id__ds_partitioned__month
+ , subq_5.account_id__ds_partitioned__quarter
+ , subq_5.account_id__ds_partitioned__year
+ , subq_5.account_id__ds_partitioned__extract_year
+ , subq_5.account_id__ds_partitioned__extract_quarter
+ , subq_5.account_id__ds_partitioned__extract_month
+ , subq_5.account_id__ds_partitioned__extract_day
+ , subq_5.account_id__ds_partitioned__extract_dow
+ , subq_5.account_id__ds_partitioned__extract_doy
+ , subq_5.account_id__ds__day
+ , subq_5.account_id__ds__week
+ , subq_5.account_id__ds__month
+ , subq_5.account_id__ds__quarter
+ , subq_5.account_id__ds__year
+ , subq_5.account_id__ds__extract_year
+ , subq_5.account_id__ds__extract_quarter
+ , subq_5.account_id__ds__extract_month
+ , subq_5.account_id__ds__extract_day
+ , subq_5.account_id__ds__extract_dow
+ , subq_5.account_id__ds__extract_doy
+ , subq_5.ds__day AS metric_time__day
+ , subq_5.ds__week AS metric_time__week
+ , subq_5.ds__month AS metric_time__month
+ , subq_5.ds__quarter AS metric_time__quarter
+ , subq_5.ds__year AS metric_time__year
+ , subq_5.ds__extract_year AS metric_time__extract_year
+ , subq_5.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_5.ds__extract_month AS metric_time__extract_month
+ , subq_5.ds__extract_day AS metric_time__extract_day
+ , subq_5.ds__extract_dow AS metric_time__extract_dow
+ , subq_5.ds__extract_doy AS metric_time__extract_doy
+ , subq_5.account_id
+ , subq_5.account_month
+ , subq_5.account_id__account_month
+ , subq_5.txn_count
FROM (
-- Read Elements From Semantic Model 'account_month_txns'
SELECT
@@ -140,118 +140,199 @@ FROM (
, account_month_txns_src_22000.account_month AS account_id__account_month
, account_month_txns_src_22000.account_id
FROM ***************************.account_month_txns account_month_txns_src_22000
- ) subq_3
- ) subq_4
- ) subq_5
+ ) subq_5
+ ) subq_6
+ ) subq_7
LEFT OUTER JOIN (
-- Pass Only Elements: ['customer_id__customer_name', 'ds_partitioned__day', 'account_id']
SELECT
- subq_9.ds_partitioned__day
- , subq_9.account_id
- , subq_9.customer_id__customer_name
+ subq_13.ds_partitioned__day
+ , subq_13.account_id
+ , subq_13.customer_id__customer_name
FROM (
-- Join Standard Outputs
SELECT
- subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.account_id__ds_partitioned__day AS account_id__ds_partitioned__day
- , subq_6.account_id__ds_partitioned__week AS account_id__ds_partitioned__week
- , subq_6.account_id__ds_partitioned__month AS account_id__ds_partitioned__month
- , subq_6.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter
- , subq_6.account_id__ds_partitioned__year AS account_id__ds_partitioned__year
- , subq_6.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year
- , subq_6.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter
- , subq_6.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month
- , subq_6.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day
- , subq_6.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow
- , subq_6.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy
- , subq_6.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day
- , subq_6.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week
- , subq_6.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month
- , subq_6.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter
- , subq_6.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year
- , subq_6.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year
- , subq_6.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter
- , subq_6.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month
- , subq_6.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day
- , subq_6.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow
- , subq_6.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy
- , subq_8.ds_partitioned__day AS customer_id__ds_partitioned__day
- , subq_8.ds_partitioned__week AS customer_id__ds_partitioned__week
- , subq_8.ds_partitioned__month AS customer_id__ds_partitioned__month
- , subq_8.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter
- , subq_8.ds_partitioned__year AS customer_id__ds_partitioned__year
- , subq_8.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year
- , subq_8.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter
- , subq_8.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month
- , subq_8.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day
- , subq_8.ds_partitioned__extract_dow AS customer_id__ds_partitioned__extract_dow
- , subq_8.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy
- , subq_6.account_id AS account_id
- , subq_6.customer_id AS customer_id
- , subq_6.account_id__customer_id AS account_id__customer_id
- , subq_6.bridge_account__account_id AS bridge_account__account_id
- , subq_6.bridge_account__customer_id AS bridge_account__customer_id
- , subq_6.extra_dim AS extra_dim
- , subq_6.account_id__extra_dim AS account_id__extra_dim
- , subq_6.bridge_account__extra_dim AS bridge_account__extra_dim
- , subq_8.customer_name AS customer_id__customer_name
- , subq_8.customer_atomic_weight AS customer_id__customer_atomic_weight
+ subq_9.ds_partitioned__day AS ds_partitioned__day
+ , subq_9.ds_partitioned__week AS ds_partitioned__week
+ , subq_9.ds_partitioned__month AS ds_partitioned__month
+ , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_9.ds_partitioned__year AS ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_9.account_id__ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_9.account_id__ds_partitioned__week AS account_id__ds_partitioned__week
+ , subq_9.account_id__ds_partitioned__month AS account_id__ds_partitioned__month
+ , subq_9.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter
+ , subq_9.account_id__ds_partitioned__year AS account_id__ds_partitioned__year
+ , subq_9.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year
+ , subq_9.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter
+ , subq_9.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month
+ , subq_9.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day
+ , subq_9.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow
+ , subq_9.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy
+ , subq_9.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day
+ , subq_9.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week
+ , subq_9.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month
+ , subq_9.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter
+ , subq_9.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year
+ , subq_9.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year
+ , subq_9.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter
+ , subq_9.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month
+ , subq_9.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day
+ , subq_9.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow
+ , subq_9.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy
+ , subq_9.metric_time__day AS metric_time__day
+ , subq_9.metric_time__week AS metric_time__week
+ , subq_9.metric_time__month AS metric_time__month
+ , subq_9.metric_time__quarter AS metric_time__quarter
+ , subq_9.metric_time__year AS metric_time__year
+ , subq_9.metric_time__extract_year AS metric_time__extract_year
+ , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_9.metric_time__extract_month AS metric_time__extract_month
+ , subq_9.metric_time__extract_day AS metric_time__extract_day
+ , subq_9.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_9.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_12.ds_partitioned__day AS customer_id__ds_partitioned__day
+ , subq_12.ds_partitioned__week AS customer_id__ds_partitioned__week
+ , subq_12.ds_partitioned__month AS customer_id__ds_partitioned__month
+ , subq_12.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter
+ , subq_12.ds_partitioned__year AS customer_id__ds_partitioned__year
+ , subq_12.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year
+ , subq_12.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter
+ , subq_12.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month
+ , subq_12.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day
+ , subq_12.ds_partitioned__extract_dow AS customer_id__ds_partitioned__extract_dow
+ , subq_12.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy
+ , subq_12.metric_time__day AS customer_id__metric_time__day
+ , subq_12.metric_time__week AS customer_id__metric_time__week
+ , subq_12.metric_time__month AS customer_id__metric_time__month
+ , subq_12.metric_time__quarter AS customer_id__metric_time__quarter
+ , subq_12.metric_time__year AS customer_id__metric_time__year
+ , subq_12.metric_time__extract_year AS customer_id__metric_time__extract_year
+ , subq_12.metric_time__extract_quarter AS customer_id__metric_time__extract_quarter
+ , subq_12.metric_time__extract_month AS customer_id__metric_time__extract_month
+ , subq_12.metric_time__extract_day AS customer_id__metric_time__extract_day
+ , subq_12.metric_time__extract_dow AS customer_id__metric_time__extract_dow
+ , subq_12.metric_time__extract_doy AS customer_id__metric_time__extract_doy
+ , subq_9.account_id AS account_id
+ , subq_9.customer_id AS customer_id
+ , subq_9.account_id__customer_id AS account_id__customer_id
+ , subq_9.bridge_account__account_id AS bridge_account__account_id
+ , subq_9.bridge_account__customer_id AS bridge_account__customer_id
+ , subq_9.extra_dim AS extra_dim
+ , subq_9.account_id__extra_dim AS account_id__extra_dim
+ , subq_9.bridge_account__extra_dim AS bridge_account__extra_dim
+ , subq_12.customer_name AS customer_id__customer_name
+ , subq_12.customer_atomic_weight AS customer_id__customer_atomic_weight
+ , subq_9.account_customer_combos AS account_customer_combos
FROM (
- -- Read Elements From Semantic Model 'bridge_table'
+ -- Metric Time Dimension 'ds_partitioned'
SELECT
- bridge_table_src_22000.extra_dim
- , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
- , bridge_table_src_22000.extra_dim AS account_id__extra_dim
- , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
- , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
- , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
- , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
- , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
- , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
- , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
- , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim
- , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__day
- , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__week
- , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__month
- , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__quarter
- , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__year
- , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month
- , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy
- , bridge_table_src_22000.account_id
- , bridge_table_src_22000.customer_id
- , bridge_table_src_22000.customer_id AS account_id__customer_id
- , bridge_table_src_22000.account_id AS bridge_account__account_id
- , bridge_table_src_22000.customer_id AS bridge_account__customer_id
- FROM ***************************.bridge_table bridge_table_src_22000
- ) subq_6
+ subq_8.ds_partitioned__day
+ , subq_8.ds_partitioned__week
+ , subq_8.ds_partitioned__month
+ , subq_8.ds_partitioned__quarter
+ , subq_8.ds_partitioned__year
+ , subq_8.ds_partitioned__extract_year
+ , subq_8.ds_partitioned__extract_quarter
+ , subq_8.ds_partitioned__extract_month
+ , subq_8.ds_partitioned__extract_day
+ , subq_8.ds_partitioned__extract_dow
+ , subq_8.ds_partitioned__extract_doy
+ , subq_8.account_id__ds_partitioned__day
+ , subq_8.account_id__ds_partitioned__week
+ , subq_8.account_id__ds_partitioned__month
+ , subq_8.account_id__ds_partitioned__quarter
+ , subq_8.account_id__ds_partitioned__year
+ , subq_8.account_id__ds_partitioned__extract_year
+ , subq_8.account_id__ds_partitioned__extract_quarter
+ , subq_8.account_id__ds_partitioned__extract_month
+ , subq_8.account_id__ds_partitioned__extract_day
+ , subq_8.account_id__ds_partitioned__extract_dow
+ , subq_8.account_id__ds_partitioned__extract_doy
+ , subq_8.bridge_account__ds_partitioned__day
+ , subq_8.bridge_account__ds_partitioned__week
+ , subq_8.bridge_account__ds_partitioned__month
+ , subq_8.bridge_account__ds_partitioned__quarter
+ , subq_8.bridge_account__ds_partitioned__year
+ , subq_8.bridge_account__ds_partitioned__extract_year
+ , subq_8.bridge_account__ds_partitioned__extract_quarter
+ , subq_8.bridge_account__ds_partitioned__extract_month
+ , subq_8.bridge_account__ds_partitioned__extract_day
+ , subq_8.bridge_account__ds_partitioned__extract_dow
+ , subq_8.bridge_account__ds_partitioned__extract_doy
+ , subq_8.ds_partitioned__day AS metric_time__day
+ , subq_8.ds_partitioned__week AS metric_time__week
+ , subq_8.ds_partitioned__month AS metric_time__month
+ , subq_8.ds_partitioned__quarter AS metric_time__quarter
+ , subq_8.ds_partitioned__year AS metric_time__year
+ , subq_8.ds_partitioned__extract_year AS metric_time__extract_year
+ , subq_8.ds_partitioned__extract_quarter AS metric_time__extract_quarter
+ , subq_8.ds_partitioned__extract_month AS metric_time__extract_month
+ , subq_8.ds_partitioned__extract_day AS metric_time__extract_day
+ , subq_8.ds_partitioned__extract_dow AS metric_time__extract_dow
+ , subq_8.ds_partitioned__extract_doy AS metric_time__extract_doy
+ , subq_8.account_id
+ , subq_8.customer_id
+ , subq_8.account_id__customer_id
+ , subq_8.bridge_account__account_id
+ , subq_8.bridge_account__customer_id
+ , subq_8.extra_dim
+ , subq_8.account_id__extra_dim
+ , subq_8.bridge_account__extra_dim
+ , subq_8.account_customer_combos
+ FROM (
+ -- Read Elements From Semantic Model 'bridge_table'
+ SELECT
+ account_id || customer_id AS account_customer_combos
+ , bridge_table_src_22000.extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(dayofweekiso FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS account_id__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
+ , EXTRACT(dayofweekiso FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_day
+ , EXTRACT(dayofweekiso FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy
+ , bridge_table_src_22000.account_id
+ , bridge_table_src_22000.customer_id
+ , bridge_table_src_22000.customer_id AS account_id__customer_id
+ , bridge_table_src_22000.account_id AS bridge_account__account_id
+ , bridge_table_src_22000.customer_id AS bridge_account__customer_id
+ FROM ***************************.bridge_table bridge_table_src_22000
+ ) subq_8
+ ) subq_9
LEFT OUTER JOIN (
-- Pass Only Elements: [
-- 'customer_name',
@@ -280,85 +361,151 @@ FROM (
-- 'customer_id__ds_partitioned__extract_day',
-- 'customer_id__ds_partitioned__extract_dow',
-- 'customer_id__ds_partitioned__extract_doy',
+ -- 'metric_time__day',
+ -- 'metric_time__week',
+ -- 'metric_time__month',
+ -- 'metric_time__quarter',
+ -- 'metric_time__year',
+ -- 'metric_time__extract_year',
+ -- 'metric_time__extract_quarter',
+ -- 'metric_time__extract_month',
+ -- 'metric_time__extract_day',
+ -- 'metric_time__extract_dow',
+ -- 'metric_time__extract_doy',
-- 'customer_id',
-- ]
SELECT
- subq_7.ds_partitioned__day
- , subq_7.ds_partitioned__week
- , subq_7.ds_partitioned__month
- , subq_7.ds_partitioned__quarter
- , subq_7.ds_partitioned__year
- , subq_7.ds_partitioned__extract_year
- , subq_7.ds_partitioned__extract_quarter
- , subq_7.ds_partitioned__extract_month
- , subq_7.ds_partitioned__extract_day
- , subq_7.ds_partitioned__extract_dow
- , subq_7.ds_partitioned__extract_doy
- , subq_7.customer_id__ds_partitioned__day
- , subq_7.customer_id__ds_partitioned__week
- , subq_7.customer_id__ds_partitioned__month
- , subq_7.customer_id__ds_partitioned__quarter
- , subq_7.customer_id__ds_partitioned__year
- , subq_7.customer_id__ds_partitioned__extract_year
- , subq_7.customer_id__ds_partitioned__extract_quarter
- , subq_7.customer_id__ds_partitioned__extract_month
- , subq_7.customer_id__ds_partitioned__extract_day
- , subq_7.customer_id__ds_partitioned__extract_dow
- , subq_7.customer_id__ds_partitioned__extract_doy
- , subq_7.customer_id
- , subq_7.customer_name
- , subq_7.customer_atomic_weight
- , subq_7.customer_id__customer_name
- , subq_7.customer_id__customer_atomic_weight
+ subq_11.ds_partitioned__day
+ , subq_11.ds_partitioned__week
+ , subq_11.ds_partitioned__month
+ , subq_11.ds_partitioned__quarter
+ , subq_11.ds_partitioned__year
+ , subq_11.ds_partitioned__extract_year
+ , subq_11.ds_partitioned__extract_quarter
+ , subq_11.ds_partitioned__extract_month
+ , subq_11.ds_partitioned__extract_day
+ , subq_11.ds_partitioned__extract_dow
+ , subq_11.ds_partitioned__extract_doy
+ , subq_11.customer_id__ds_partitioned__day
+ , subq_11.customer_id__ds_partitioned__week
+ , subq_11.customer_id__ds_partitioned__month
+ , subq_11.customer_id__ds_partitioned__quarter
+ , subq_11.customer_id__ds_partitioned__year
+ , subq_11.customer_id__ds_partitioned__extract_year
+ , subq_11.customer_id__ds_partitioned__extract_quarter
+ , subq_11.customer_id__ds_partitioned__extract_month
+ , subq_11.customer_id__ds_partitioned__extract_day
+ , subq_11.customer_id__ds_partitioned__extract_dow
+ , subq_11.customer_id__ds_partitioned__extract_doy
+ , subq_11.metric_time__day
+ , subq_11.metric_time__week
+ , subq_11.metric_time__month
+ , subq_11.metric_time__quarter
+ , subq_11.metric_time__year
+ , subq_11.metric_time__extract_year
+ , subq_11.metric_time__extract_quarter
+ , subq_11.metric_time__extract_month
+ , subq_11.metric_time__extract_day
+ , subq_11.metric_time__extract_dow
+ , subq_11.metric_time__extract_doy
+ , subq_11.customer_id
+ , subq_11.customer_name
+ , subq_11.customer_atomic_weight
+ , subq_11.customer_id__customer_name
+ , subq_11.customer_id__customer_atomic_weight
FROM (
- -- Read Elements From Semantic Model 'customer_table'
+ -- Metric Time Dimension 'ds_partitioned'
SELECT
- customer_table_src_22000.customer_name
- , customer_table_src_22000.customer_atomic_weight
- , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
- , customer_table_src_22000.customer_name AS customer_id__customer_name
- , customer_table_src_22000.customer_atomic_weight AS customer_id__customer_atomic_weight
- , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__day
- , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__week
- , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__month
- , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__quarter
- , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__year
- , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_year
- , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter
- , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_month
- , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_dow
- , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_doy
- , customer_table_src_22000.customer_id
- FROM ***************************.customer_table customer_table_src_22000
- ) subq_7
- ) subq_8
+ subq_10.ds_partitioned__day
+ , subq_10.ds_partitioned__week
+ , subq_10.ds_partitioned__month
+ , subq_10.ds_partitioned__quarter
+ , subq_10.ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy
+ , subq_10.customer_id__ds_partitioned__day
+ , subq_10.customer_id__ds_partitioned__week
+ , subq_10.customer_id__ds_partitioned__month
+ , subq_10.customer_id__ds_partitioned__quarter
+ , subq_10.customer_id__ds_partitioned__year
+ , subq_10.customer_id__ds_partitioned__extract_year
+ , subq_10.customer_id__ds_partitioned__extract_quarter
+ , subq_10.customer_id__ds_partitioned__extract_month
+ , subq_10.customer_id__ds_partitioned__extract_day
+ , subq_10.customer_id__ds_partitioned__extract_dow
+ , subq_10.customer_id__ds_partitioned__extract_doy
+ , subq_10.ds_partitioned__day AS metric_time__day
+ , subq_10.ds_partitioned__week AS metric_time__week
+ , subq_10.ds_partitioned__month AS metric_time__month
+ , subq_10.ds_partitioned__quarter AS metric_time__quarter
+ , subq_10.ds_partitioned__year AS metric_time__year
+ , subq_10.ds_partitioned__extract_year AS metric_time__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS metric_time__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS metric_time__extract_month
+ , subq_10.ds_partitioned__extract_day AS metric_time__extract_day
+ , subq_10.ds_partitioned__extract_dow AS metric_time__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS metric_time__extract_doy
+ , subq_10.customer_id
+ , subq_10.customer_name
+ , subq_10.customer_atomic_weight
+ , subq_10.customer_id__customer_name
+ , subq_10.customer_id__customer_atomic_weight
+ , subq_10.customers
+ FROM (
+ -- Read Elements From Semantic Model 'customer_table'
+ SELECT
+ 1 AS customers
+ , customer_table_src_22000.customer_name
+ , customer_table_src_22000.customer_atomic_weight
+ , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(dayofweekiso FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , customer_table_src_22000.customer_name AS customer_id__customer_name
+ , customer_table_src_22000.customer_atomic_weight AS customer_id__customer_atomic_weight
+ , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__day
+ , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__week
+ , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__year
+ , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_day
+ , EXTRACT(dayofweekiso FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_doy
+ , customer_table_src_22000.customer_id
+ FROM ***************************.customer_table customer_table_src_22000
+ ) subq_10
+ ) subq_11
+ ) subq_12
ON
(
- subq_6.customer_id = subq_8.customer_id
+ subq_9.customer_id = subq_12.customer_id
) AND (
- subq_6.ds_partitioned__day = subq_8.ds_partitioned__day
+ subq_9.ds_partitioned__day = subq_12.ds_partitioned__day
)
- ) subq_9
- ) subq_10
+ ) subq_13
+ ) subq_14
ON
(
- subq_5.account_id = subq_10.account_id
+ subq_7.account_id = subq_14.account_id
) AND (
- subq_5.ds_partitioned__day = subq_10.ds_partitioned__day
+ subq_7.ds_partitioned__day = subq_14.ds_partitioned__day
)
- ) subq_11
- ) subq_12
+ ) subq_15
+ ) subq_16
GROUP BY
- subq_12.account_id__customer_id__customer_name
-) subq_13
+ subq_16.account_id__customer_id__customer_name
+) subq_17
diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0_optimized.sql
index 3081559380..ee22b130fc 100644
--- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0_optimized.sql
+++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Snowflake/test_multihop_node__plan0_optimized.sql
@@ -3,7 +3,7 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_21.customer_id__customer_name AS account_id__customer_id__customer_name
+ subq_27.customer_id__customer_name AS account_id__customer_id__customer_name
, SUM(account_month_txns_src_22000.txn_count) AS txn_count
FROM ***************************.account_month_txns account_month_txns_src_22000
LEFT OUTER JOIN (
@@ -22,12 +22,12 @@ LEFT OUTER JOIN (
) AND (
DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) = DATE_TRUNC('day', customer_table_src_22000.ds_partitioned)
)
-) subq_21
+) subq_27
ON
(
- account_month_txns_src_22000.account_id = subq_21.account_id
+ account_month_txns_src_22000.account_id = subq_27.account_id
) AND (
- DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_21.ds_partitioned__day
+ DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_27.ds_partitioned__day
)
GROUP BY
- subq_21.customer_id__customer_name
+ subq_27.customer_id__customer_name
diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multihop_node__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multihop_node__plan0.sql
index 00fb370765..39ee9a9bdf 100644
--- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multihop_node__plan0.sql
+++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multihop_node__plan0.sql
@@ -1,93 +1,93 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.account_id__customer_id__customer_name
- , subq_13.txn_count
+ subq_17.account_id__customer_id__customer_name
+ , subq_17.txn_count
FROM (
-- Aggregate Measures
SELECT
- subq_12.account_id__customer_id__customer_name
- , SUM(subq_12.txn_count) AS txn_count
+ subq_16.account_id__customer_id__customer_name
+ , SUM(subq_16.txn_count) AS txn_count
FROM (
-- Pass Only Elements: ['txn_count', 'account_id__customer_id__customer_name']
SELECT
- subq_11.account_id__customer_id__customer_name
- , subq_11.txn_count
+ subq_15.account_id__customer_id__customer_name
+ , subq_15.txn_count
FROM (
-- Join Standard Outputs
SELECT
- subq_5.ds_partitioned__day AS ds_partitioned__day
- , subq_10.ds_partitioned__day AS account_id__ds_partitioned__day
- , subq_5.account_id AS account_id
- , subq_10.customer_id__customer_name AS account_id__customer_id__customer_name
- , subq_5.txn_count AS txn_count
+ subq_7.ds_partitioned__day AS ds_partitioned__day
+ , subq_14.ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_7.account_id AS account_id
+ , subq_14.customer_id__customer_name AS account_id__customer_id__customer_name
+ , subq_7.txn_count AS txn_count
FROM (
-- Pass Only Elements: ['txn_count', 'ds_partitioned__day', 'account_id']
SELECT
- subq_4.ds_partitioned__day
- , subq_4.account_id
- , subq_4.txn_count
+ subq_6.ds_partitioned__day
+ , subq_6.account_id
+ , subq_6.txn_count
FROM (
-- Metric Time Dimension 'ds'
SELECT
- 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.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.account_id__ds_partitioned__day
- , subq_3.account_id__ds_partitioned__week
- , subq_3.account_id__ds_partitioned__month
- , subq_3.account_id__ds_partitioned__quarter
- , subq_3.account_id__ds_partitioned__year
- , subq_3.account_id__ds_partitioned__extract_year
- , subq_3.account_id__ds_partitioned__extract_quarter
- , subq_3.account_id__ds_partitioned__extract_month
- , subq_3.account_id__ds_partitioned__extract_day
- , subq_3.account_id__ds_partitioned__extract_dow
- , subq_3.account_id__ds_partitioned__extract_doy
- , subq_3.account_id__ds__day
- , subq_3.account_id__ds__week
- , subq_3.account_id__ds__month
- , subq_3.account_id__ds__quarter
- , subq_3.account_id__ds__year
- , subq_3.account_id__ds__extract_year
- , subq_3.account_id__ds__extract_quarter
- , subq_3.account_id__ds__extract_month
- , subq_3.account_id__ds__extract_day
- , subq_3.account_id__ds__extract_dow
- , subq_3.account_id__ds__extract_doy
- , subq_3.ds__day AS metric_time__day
- , subq_3.ds__week AS metric_time__week
- , subq_3.ds__month AS metric_time__month
- , subq_3.ds__quarter AS metric_time__quarter
- , subq_3.ds__year AS metric_time__year
- , subq_3.ds__extract_year AS metric_time__extract_year
- , subq_3.ds__extract_quarter AS metric_time__extract_quarter
- , subq_3.ds__extract_month AS metric_time__extract_month
- , subq_3.ds__extract_day AS metric_time__extract_day
- , subq_3.ds__extract_dow AS metric_time__extract_dow
- , subq_3.ds__extract_doy AS metric_time__extract_doy
- , subq_3.account_id
- , subq_3.account_month
- , subq_3.account_id__account_month
- , subq_3.txn_count
+ subq_5.ds_partitioned__day
+ , subq_5.ds_partitioned__week
+ , subq_5.ds_partitioned__month
+ , subq_5.ds_partitioned__quarter
+ , subq_5.ds_partitioned__year
+ , subq_5.ds_partitioned__extract_year
+ , subq_5.ds_partitioned__extract_quarter
+ , subq_5.ds_partitioned__extract_month
+ , subq_5.ds_partitioned__extract_day
+ , subq_5.ds_partitioned__extract_dow
+ , subq_5.ds_partitioned__extract_doy
+ , subq_5.ds__day
+ , subq_5.ds__week
+ , subq_5.ds__month
+ , subq_5.ds__quarter
+ , subq_5.ds__year
+ , subq_5.ds__extract_year
+ , subq_5.ds__extract_quarter
+ , subq_5.ds__extract_month
+ , subq_5.ds__extract_day
+ , subq_5.ds__extract_dow
+ , subq_5.ds__extract_doy
+ , subq_5.account_id__ds_partitioned__day
+ , subq_5.account_id__ds_partitioned__week
+ , subq_5.account_id__ds_partitioned__month
+ , subq_5.account_id__ds_partitioned__quarter
+ , subq_5.account_id__ds_partitioned__year
+ , subq_5.account_id__ds_partitioned__extract_year
+ , subq_5.account_id__ds_partitioned__extract_quarter
+ , subq_5.account_id__ds_partitioned__extract_month
+ , subq_5.account_id__ds_partitioned__extract_day
+ , subq_5.account_id__ds_partitioned__extract_dow
+ , subq_5.account_id__ds_partitioned__extract_doy
+ , subq_5.account_id__ds__day
+ , subq_5.account_id__ds__week
+ , subq_5.account_id__ds__month
+ , subq_5.account_id__ds__quarter
+ , subq_5.account_id__ds__year
+ , subq_5.account_id__ds__extract_year
+ , subq_5.account_id__ds__extract_quarter
+ , subq_5.account_id__ds__extract_month
+ , subq_5.account_id__ds__extract_day
+ , subq_5.account_id__ds__extract_dow
+ , subq_5.account_id__ds__extract_doy
+ , subq_5.ds__day AS metric_time__day
+ , subq_5.ds__week AS metric_time__week
+ , subq_5.ds__month AS metric_time__month
+ , subq_5.ds__quarter AS metric_time__quarter
+ , subq_5.ds__year AS metric_time__year
+ , subq_5.ds__extract_year AS metric_time__extract_year
+ , subq_5.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_5.ds__extract_month AS metric_time__extract_month
+ , subq_5.ds__extract_day AS metric_time__extract_day
+ , subq_5.ds__extract_dow AS metric_time__extract_dow
+ , subq_5.ds__extract_doy AS metric_time__extract_doy
+ , subq_5.account_id
+ , subq_5.account_month
+ , subq_5.account_id__account_month
+ , subq_5.txn_count
FROM (
-- Read Elements From Semantic Model 'account_month_txns'
SELECT
@@ -140,118 +140,199 @@ FROM (
, account_month_txns_src_22000.account_month AS account_id__account_month
, account_month_txns_src_22000.account_id
FROM ***************************.account_month_txns account_month_txns_src_22000
- ) subq_3
- ) subq_4
- ) subq_5
+ ) subq_5
+ ) subq_6
+ ) subq_7
LEFT OUTER JOIN (
-- Pass Only Elements: ['customer_id__customer_name', 'ds_partitioned__day', 'account_id']
SELECT
- subq_9.ds_partitioned__day
- , subq_9.account_id
- , subq_9.customer_id__customer_name
+ subq_13.ds_partitioned__day
+ , subq_13.account_id
+ , subq_13.customer_id__customer_name
FROM (
-- Join Standard Outputs
SELECT
- subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.account_id__ds_partitioned__day AS account_id__ds_partitioned__day
- , subq_6.account_id__ds_partitioned__week AS account_id__ds_partitioned__week
- , subq_6.account_id__ds_partitioned__month AS account_id__ds_partitioned__month
- , subq_6.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter
- , subq_6.account_id__ds_partitioned__year AS account_id__ds_partitioned__year
- , subq_6.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year
- , subq_6.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter
- , subq_6.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month
- , subq_6.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day
- , subq_6.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow
- , subq_6.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy
- , subq_6.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day
- , subq_6.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week
- , subq_6.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month
- , subq_6.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter
- , subq_6.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year
- , subq_6.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year
- , subq_6.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter
- , subq_6.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month
- , subq_6.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day
- , subq_6.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow
- , subq_6.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy
- , subq_8.ds_partitioned__day AS customer_id__ds_partitioned__day
- , subq_8.ds_partitioned__week AS customer_id__ds_partitioned__week
- , subq_8.ds_partitioned__month AS customer_id__ds_partitioned__month
- , subq_8.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter
- , subq_8.ds_partitioned__year AS customer_id__ds_partitioned__year
- , subq_8.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year
- , subq_8.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter
- , subq_8.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month
- , subq_8.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day
- , subq_8.ds_partitioned__extract_dow AS customer_id__ds_partitioned__extract_dow
- , subq_8.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy
- , subq_6.account_id AS account_id
- , subq_6.customer_id AS customer_id
- , subq_6.account_id__customer_id AS account_id__customer_id
- , subq_6.bridge_account__account_id AS bridge_account__account_id
- , subq_6.bridge_account__customer_id AS bridge_account__customer_id
- , subq_6.extra_dim AS extra_dim
- , subq_6.account_id__extra_dim AS account_id__extra_dim
- , subq_6.bridge_account__extra_dim AS bridge_account__extra_dim
- , subq_8.customer_name AS customer_id__customer_name
- , subq_8.customer_atomic_weight AS customer_id__customer_atomic_weight
+ subq_9.ds_partitioned__day AS ds_partitioned__day
+ , subq_9.ds_partitioned__week AS ds_partitioned__week
+ , subq_9.ds_partitioned__month AS ds_partitioned__month
+ , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_9.ds_partitioned__year AS ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_9.account_id__ds_partitioned__day AS account_id__ds_partitioned__day
+ , subq_9.account_id__ds_partitioned__week AS account_id__ds_partitioned__week
+ , subq_9.account_id__ds_partitioned__month AS account_id__ds_partitioned__month
+ , subq_9.account_id__ds_partitioned__quarter AS account_id__ds_partitioned__quarter
+ , subq_9.account_id__ds_partitioned__year AS account_id__ds_partitioned__year
+ , subq_9.account_id__ds_partitioned__extract_year AS account_id__ds_partitioned__extract_year
+ , subq_9.account_id__ds_partitioned__extract_quarter AS account_id__ds_partitioned__extract_quarter
+ , subq_9.account_id__ds_partitioned__extract_month AS account_id__ds_partitioned__extract_month
+ , subq_9.account_id__ds_partitioned__extract_day AS account_id__ds_partitioned__extract_day
+ , subq_9.account_id__ds_partitioned__extract_dow AS account_id__ds_partitioned__extract_dow
+ , subq_9.account_id__ds_partitioned__extract_doy AS account_id__ds_partitioned__extract_doy
+ , subq_9.bridge_account__ds_partitioned__day AS bridge_account__ds_partitioned__day
+ , subq_9.bridge_account__ds_partitioned__week AS bridge_account__ds_partitioned__week
+ , subq_9.bridge_account__ds_partitioned__month AS bridge_account__ds_partitioned__month
+ , subq_9.bridge_account__ds_partitioned__quarter AS bridge_account__ds_partitioned__quarter
+ , subq_9.bridge_account__ds_partitioned__year AS bridge_account__ds_partitioned__year
+ , subq_9.bridge_account__ds_partitioned__extract_year AS bridge_account__ds_partitioned__extract_year
+ , subq_9.bridge_account__ds_partitioned__extract_quarter AS bridge_account__ds_partitioned__extract_quarter
+ , subq_9.bridge_account__ds_partitioned__extract_month AS bridge_account__ds_partitioned__extract_month
+ , subq_9.bridge_account__ds_partitioned__extract_day AS bridge_account__ds_partitioned__extract_day
+ , subq_9.bridge_account__ds_partitioned__extract_dow AS bridge_account__ds_partitioned__extract_dow
+ , subq_9.bridge_account__ds_partitioned__extract_doy AS bridge_account__ds_partitioned__extract_doy
+ , subq_9.metric_time__day AS metric_time__day
+ , subq_9.metric_time__week AS metric_time__week
+ , subq_9.metric_time__month AS metric_time__month
+ , subq_9.metric_time__quarter AS metric_time__quarter
+ , subq_9.metric_time__year AS metric_time__year
+ , subq_9.metric_time__extract_year AS metric_time__extract_year
+ , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_9.metric_time__extract_month AS metric_time__extract_month
+ , subq_9.metric_time__extract_day AS metric_time__extract_day
+ , subq_9.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_9.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_12.ds_partitioned__day AS customer_id__ds_partitioned__day
+ , subq_12.ds_partitioned__week AS customer_id__ds_partitioned__week
+ , subq_12.ds_partitioned__month AS customer_id__ds_partitioned__month
+ , subq_12.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter
+ , subq_12.ds_partitioned__year AS customer_id__ds_partitioned__year
+ , subq_12.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year
+ , subq_12.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter
+ , subq_12.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month
+ , subq_12.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day
+ , subq_12.ds_partitioned__extract_dow AS customer_id__ds_partitioned__extract_dow
+ , subq_12.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy
+ , subq_12.metric_time__day AS customer_id__metric_time__day
+ , subq_12.metric_time__week AS customer_id__metric_time__week
+ , subq_12.metric_time__month AS customer_id__metric_time__month
+ , subq_12.metric_time__quarter AS customer_id__metric_time__quarter
+ , subq_12.metric_time__year AS customer_id__metric_time__year
+ , subq_12.metric_time__extract_year AS customer_id__metric_time__extract_year
+ , subq_12.metric_time__extract_quarter AS customer_id__metric_time__extract_quarter
+ , subq_12.metric_time__extract_month AS customer_id__metric_time__extract_month
+ , subq_12.metric_time__extract_day AS customer_id__metric_time__extract_day
+ , subq_12.metric_time__extract_dow AS customer_id__metric_time__extract_dow
+ , subq_12.metric_time__extract_doy AS customer_id__metric_time__extract_doy
+ , subq_9.account_id AS account_id
+ , subq_9.customer_id AS customer_id
+ , subq_9.account_id__customer_id AS account_id__customer_id
+ , subq_9.bridge_account__account_id AS bridge_account__account_id
+ , subq_9.bridge_account__customer_id AS bridge_account__customer_id
+ , subq_9.extra_dim AS extra_dim
+ , subq_9.account_id__extra_dim AS account_id__extra_dim
+ , subq_9.bridge_account__extra_dim AS bridge_account__extra_dim
+ , subq_12.customer_name AS customer_id__customer_name
+ , subq_12.customer_atomic_weight AS customer_id__customer_atomic_weight
+ , subq_9.account_customer_combos AS account_customer_combos
FROM (
- -- Read Elements From Semantic Model 'bridge_table'
+ -- Metric Time Dimension 'ds_partitioned'
SELECT
- bridge_table_src_22000.extra_dim
- , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
- , bridge_table_src_22000.extra_dim AS account_id__extra_dim
- , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
- , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
- , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
- , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
- , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
- , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
- , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
- , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim
- , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__day
- , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__week
- , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__month
- , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__quarter
- , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__year
- , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month
- , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy
- , bridge_table_src_22000.account_id
- , bridge_table_src_22000.customer_id
- , bridge_table_src_22000.customer_id AS account_id__customer_id
- , bridge_table_src_22000.account_id AS bridge_account__account_id
- , bridge_table_src_22000.customer_id AS bridge_account__customer_id
- FROM ***************************.bridge_table bridge_table_src_22000
- ) subq_6
+ subq_8.ds_partitioned__day
+ , subq_8.ds_partitioned__week
+ , subq_8.ds_partitioned__month
+ , subq_8.ds_partitioned__quarter
+ , subq_8.ds_partitioned__year
+ , subq_8.ds_partitioned__extract_year
+ , subq_8.ds_partitioned__extract_quarter
+ , subq_8.ds_partitioned__extract_month
+ , subq_8.ds_partitioned__extract_day
+ , subq_8.ds_partitioned__extract_dow
+ , subq_8.ds_partitioned__extract_doy
+ , subq_8.account_id__ds_partitioned__day
+ , subq_8.account_id__ds_partitioned__week
+ , subq_8.account_id__ds_partitioned__month
+ , subq_8.account_id__ds_partitioned__quarter
+ , subq_8.account_id__ds_partitioned__year
+ , subq_8.account_id__ds_partitioned__extract_year
+ , subq_8.account_id__ds_partitioned__extract_quarter
+ , subq_8.account_id__ds_partitioned__extract_month
+ , subq_8.account_id__ds_partitioned__extract_day
+ , subq_8.account_id__ds_partitioned__extract_dow
+ , subq_8.account_id__ds_partitioned__extract_doy
+ , subq_8.bridge_account__ds_partitioned__day
+ , subq_8.bridge_account__ds_partitioned__week
+ , subq_8.bridge_account__ds_partitioned__month
+ , subq_8.bridge_account__ds_partitioned__quarter
+ , subq_8.bridge_account__ds_partitioned__year
+ , subq_8.bridge_account__ds_partitioned__extract_year
+ , subq_8.bridge_account__ds_partitioned__extract_quarter
+ , subq_8.bridge_account__ds_partitioned__extract_month
+ , subq_8.bridge_account__ds_partitioned__extract_day
+ , subq_8.bridge_account__ds_partitioned__extract_dow
+ , subq_8.bridge_account__ds_partitioned__extract_doy
+ , subq_8.ds_partitioned__day AS metric_time__day
+ , subq_8.ds_partitioned__week AS metric_time__week
+ , subq_8.ds_partitioned__month AS metric_time__month
+ , subq_8.ds_partitioned__quarter AS metric_time__quarter
+ , subq_8.ds_partitioned__year AS metric_time__year
+ , subq_8.ds_partitioned__extract_year AS metric_time__extract_year
+ , subq_8.ds_partitioned__extract_quarter AS metric_time__extract_quarter
+ , subq_8.ds_partitioned__extract_month AS metric_time__extract_month
+ , subq_8.ds_partitioned__extract_day AS metric_time__extract_day
+ , subq_8.ds_partitioned__extract_dow AS metric_time__extract_dow
+ , subq_8.ds_partitioned__extract_doy AS metric_time__extract_doy
+ , subq_8.account_id
+ , subq_8.customer_id
+ , subq_8.account_id__customer_id
+ , subq_8.bridge_account__account_id
+ , subq_8.bridge_account__customer_id
+ , subq_8.extra_dim
+ , subq_8.account_id__extra_dim
+ , subq_8.bridge_account__extra_dim
+ , subq_8.account_customer_combos
+ FROM (
+ -- Read Elements From Semantic Model 'bridge_table'
+ SELECT
+ account_id || customer_id AS account_customer_combos
+ , bridge_table_src_22000.extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS account_id__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS account_id__ds_partitioned__extract_doy
+ , bridge_table_src_22000.extra_dim AS bridge_account__extra_dim
+ , DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__day
+ , DATE_TRUNC('week', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__week
+ , DATE_TRUNC('month', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__month
+ , DATE_TRUNC('quarter', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__quarter
+ , DATE_TRUNC('year', bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__year
+ , EXTRACT(year FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_month
+ , EXTRACT(day FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bridge_table_src_22000.ds_partitioned) AS bridge_account__ds_partitioned__extract_doy
+ , bridge_table_src_22000.account_id
+ , bridge_table_src_22000.customer_id
+ , bridge_table_src_22000.customer_id AS account_id__customer_id
+ , bridge_table_src_22000.account_id AS bridge_account__account_id
+ , bridge_table_src_22000.customer_id AS bridge_account__customer_id
+ FROM ***************************.bridge_table bridge_table_src_22000
+ ) subq_8
+ ) subq_9
LEFT OUTER JOIN (
-- Pass Only Elements: [
-- 'customer_name',
@@ -280,85 +361,151 @@ FROM (
-- 'customer_id__ds_partitioned__extract_day',
-- 'customer_id__ds_partitioned__extract_dow',
-- 'customer_id__ds_partitioned__extract_doy',
+ -- 'metric_time__day',
+ -- 'metric_time__week',
+ -- 'metric_time__month',
+ -- 'metric_time__quarter',
+ -- 'metric_time__year',
+ -- 'metric_time__extract_year',
+ -- 'metric_time__extract_quarter',
+ -- 'metric_time__extract_month',
+ -- 'metric_time__extract_day',
+ -- 'metric_time__extract_dow',
+ -- 'metric_time__extract_doy',
-- 'customer_id',
-- ]
SELECT
- subq_7.ds_partitioned__day
- , subq_7.ds_partitioned__week
- , subq_7.ds_partitioned__month
- , subq_7.ds_partitioned__quarter
- , subq_7.ds_partitioned__year
- , subq_7.ds_partitioned__extract_year
- , subq_7.ds_partitioned__extract_quarter
- , subq_7.ds_partitioned__extract_month
- , subq_7.ds_partitioned__extract_day
- , subq_7.ds_partitioned__extract_dow
- , subq_7.ds_partitioned__extract_doy
- , subq_7.customer_id__ds_partitioned__day
- , subq_7.customer_id__ds_partitioned__week
- , subq_7.customer_id__ds_partitioned__month
- , subq_7.customer_id__ds_partitioned__quarter
- , subq_7.customer_id__ds_partitioned__year
- , subq_7.customer_id__ds_partitioned__extract_year
- , subq_7.customer_id__ds_partitioned__extract_quarter
- , subq_7.customer_id__ds_partitioned__extract_month
- , subq_7.customer_id__ds_partitioned__extract_day
- , subq_7.customer_id__ds_partitioned__extract_dow
- , subq_7.customer_id__ds_partitioned__extract_doy
- , subq_7.customer_id
- , subq_7.customer_name
- , subq_7.customer_atomic_weight
- , subq_7.customer_id__customer_name
- , subq_7.customer_id__customer_atomic_weight
+ subq_11.ds_partitioned__day
+ , subq_11.ds_partitioned__week
+ , subq_11.ds_partitioned__month
+ , subq_11.ds_partitioned__quarter
+ , subq_11.ds_partitioned__year
+ , subq_11.ds_partitioned__extract_year
+ , subq_11.ds_partitioned__extract_quarter
+ , subq_11.ds_partitioned__extract_month
+ , subq_11.ds_partitioned__extract_day
+ , subq_11.ds_partitioned__extract_dow
+ , subq_11.ds_partitioned__extract_doy
+ , subq_11.customer_id__ds_partitioned__day
+ , subq_11.customer_id__ds_partitioned__week
+ , subq_11.customer_id__ds_partitioned__month
+ , subq_11.customer_id__ds_partitioned__quarter
+ , subq_11.customer_id__ds_partitioned__year
+ , subq_11.customer_id__ds_partitioned__extract_year
+ , subq_11.customer_id__ds_partitioned__extract_quarter
+ , subq_11.customer_id__ds_partitioned__extract_month
+ , subq_11.customer_id__ds_partitioned__extract_day
+ , subq_11.customer_id__ds_partitioned__extract_dow
+ , subq_11.customer_id__ds_partitioned__extract_doy
+ , subq_11.metric_time__day
+ , subq_11.metric_time__week
+ , subq_11.metric_time__month
+ , subq_11.metric_time__quarter
+ , subq_11.metric_time__year
+ , subq_11.metric_time__extract_year
+ , subq_11.metric_time__extract_quarter
+ , subq_11.metric_time__extract_month
+ , subq_11.metric_time__extract_day
+ , subq_11.metric_time__extract_dow
+ , subq_11.metric_time__extract_doy
+ , subq_11.customer_id
+ , subq_11.customer_name
+ , subq_11.customer_atomic_weight
+ , subq_11.customer_id__customer_name
+ , subq_11.customer_id__customer_atomic_weight
FROM (
- -- Read Elements From Semantic Model 'customer_table'
+ -- Metric Time Dimension 'ds_partitioned'
SELECT
- customer_table_src_22000.customer_name
- , customer_table_src_22000.customer_atomic_weight
- , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
- , customer_table_src_22000.customer_name AS customer_id__customer_name
- , customer_table_src_22000.customer_atomic_weight AS customer_id__customer_atomic_weight
- , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__day
- , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__week
- , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__month
- , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__quarter
- , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__year
- , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_year
- , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter
- , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_month
- , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_dow
- , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_doy
- , customer_table_src_22000.customer_id
- FROM ***************************.customer_table customer_table_src_22000
- ) subq_7
- ) subq_8
+ subq_10.ds_partitioned__day
+ , subq_10.ds_partitioned__week
+ , subq_10.ds_partitioned__month
+ , subq_10.ds_partitioned__quarter
+ , subq_10.ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy
+ , subq_10.customer_id__ds_partitioned__day
+ , subq_10.customer_id__ds_partitioned__week
+ , subq_10.customer_id__ds_partitioned__month
+ , subq_10.customer_id__ds_partitioned__quarter
+ , subq_10.customer_id__ds_partitioned__year
+ , subq_10.customer_id__ds_partitioned__extract_year
+ , subq_10.customer_id__ds_partitioned__extract_quarter
+ , subq_10.customer_id__ds_partitioned__extract_month
+ , subq_10.customer_id__ds_partitioned__extract_day
+ , subq_10.customer_id__ds_partitioned__extract_dow
+ , subq_10.customer_id__ds_partitioned__extract_doy
+ , subq_10.ds_partitioned__day AS metric_time__day
+ , subq_10.ds_partitioned__week AS metric_time__week
+ , subq_10.ds_partitioned__month AS metric_time__month
+ , subq_10.ds_partitioned__quarter AS metric_time__quarter
+ , subq_10.ds_partitioned__year AS metric_time__year
+ , subq_10.ds_partitioned__extract_year AS metric_time__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS metric_time__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS metric_time__extract_month
+ , subq_10.ds_partitioned__extract_day AS metric_time__extract_day
+ , subq_10.ds_partitioned__extract_dow AS metric_time__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS metric_time__extract_doy
+ , subq_10.customer_id
+ , subq_10.customer_name
+ , subq_10.customer_atomic_weight
+ , subq_10.customer_id__customer_name
+ , subq_10.customer_id__customer_atomic_weight
+ , subq_10.customers
+ FROM (
+ -- Read Elements From Semantic Model 'customer_table'
+ SELECT
+ 1 AS customers
+ , customer_table_src_22000.customer_name
+ , customer_table_src_22000.customer_atomic_weight
+ , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS ds_partitioned__year
+ , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_year
+ , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_quarter
+ , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_month
+ , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS ds_partitioned__extract_doy
+ , customer_table_src_22000.customer_name AS customer_id__customer_name
+ , customer_table_src_22000.customer_atomic_weight AS customer_id__customer_atomic_weight
+ , DATE_TRUNC('day', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__day
+ , DATE_TRUNC('week', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__week
+ , DATE_TRUNC('month', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__month
+ , DATE_TRUNC('quarter', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__quarter
+ , DATE_TRUNC('year', customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__year
+ , EXTRACT(year FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_year
+ , EXTRACT(quarter FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_quarter
+ , EXTRACT(month FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_month
+ , EXTRACT(day FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM customer_table_src_22000.ds_partitioned) AS customer_id__ds_partitioned__extract_doy
+ , customer_table_src_22000.customer_id
+ FROM ***************************.customer_table customer_table_src_22000
+ ) subq_10
+ ) subq_11
+ ) subq_12
ON
(
- subq_6.customer_id = subq_8.customer_id
+ subq_9.customer_id = subq_12.customer_id
) AND (
- subq_6.ds_partitioned__day = subq_8.ds_partitioned__day
+ subq_9.ds_partitioned__day = subq_12.ds_partitioned__day
)
- ) subq_9
- ) subq_10
+ ) subq_13
+ ) subq_14
ON
(
- subq_5.account_id = subq_10.account_id
+ subq_7.account_id = subq_14.account_id
) AND (
- subq_5.ds_partitioned__day = subq_10.ds_partitioned__day
+ subq_7.ds_partitioned__day = subq_14.ds_partitioned__day
)
- ) subq_11
- ) subq_12
+ ) subq_15
+ ) subq_16
GROUP BY
- subq_12.account_id__customer_id__customer_name
-) subq_13
+ subq_16.account_id__customer_id__customer_name
+) subq_17
diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multihop_node__plan0_optimized.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multihop_node__plan0_optimized.sql
index 3081559380..ee22b130fc 100644
--- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multihop_node__plan0_optimized.sql
+++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/Trino/test_multihop_node__plan0_optimized.sql
@@ -3,7 +3,7 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_21.customer_id__customer_name AS account_id__customer_id__customer_name
+ subq_27.customer_id__customer_name AS account_id__customer_id__customer_name
, SUM(account_month_txns_src_22000.txn_count) AS txn_count
FROM ***************************.account_month_txns account_month_txns_src_22000
LEFT OUTER JOIN (
@@ -22,12 +22,12 @@ LEFT OUTER JOIN (
) AND (
DATE_TRUNC('day', bridge_table_src_22000.ds_partitioned) = DATE_TRUNC('day', customer_table_src_22000.ds_partitioned)
)
-) subq_21
+) subq_27
ON
(
- account_month_txns_src_22000.account_id = subq_21.account_id
+ account_month_txns_src_22000.account_id = subq_27.account_id
) AND (
- DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_21.ds_partitioned__day
+ DATE_TRUNC('day', account_month_txns_src_22000.ds_partitioned) = subq_27.ds_partitioned__day
)
GROUP BY
- subq_21.customer_id__customer_name
+ subq_27.customer_id__customer_name