From 30317331ef6a561af962569c7d8eff373af7910d Mon Sep 17 00:00:00 2001 From: Courtney Holcomb Date: Fri, 1 Nov 2024 18:34:26 -0700 Subject: [PATCH] Bug fix: Generate new select columns for instances with new entity link - commit needs cleanup --- metricflow/plan_conversion/dataflow_to_sql.py | 135 +++++++------ .../plan_conversion/instance_converters.py | 115 +---------- ...th_multi_hop_custom_granularity__plan0.sql | 116 +++++------ .../test_compute_metrics_node__plan0.sql | 4 +- ...o_from_multiple_semantic_models__plan0.sql | 8 +- ...atio_from_single_semantic_model__plan0.sql | 4 +- ...ompute_metrics_node_simple_expr__plan0.sql | 4 +- ...on_with_joined_where_constraint__plan0.sql | 4 +- ...ined_where_constraint__plan0_optimized.sql | 4 +- .../test_dimensions_requiring_join__plan0.sql | 4 +- .../DuckDB/test_multi_join_node__plan0.sql | 4 +- .../test_multi_join_node__plan0_optimized.sql | 4 +- .../test_compute_metrics_node__plan0.xml | 8 +- ...o_from_multiple_semantic_models__plan0.xml | 20 +- ...atio_from_single_semantic_model__plan0.xml | 16 +- ...ompute_metrics_node_simple_expr__plan0.xml | 8 +- ...on_with_joined_where_constraint__plan0.xml | 178 ++++++++--------- .../test_dimensions_requiring_join__plan0.xml | 170 ++++++++-------- .../test_multi_join_node__plan0.xml | 14 +- .../DuckDB/test_nested_filters__plan0.sql | 8 +- ...values_with_a_join_and_a_filter__plan0.sql | 4 +- ...h_a_join_and_a_filter__plan0_optimized.sql | 4 +- .../test_dimensions_requiring_join__plan0.sql | 4 +- ...values_with_a_join_and_a_filter__plan0.xml | 178 ++++++++--------- .../test_dimensions_requiring_join__plan0.xml | 170 ++++++++-------- ...with_joined_sub_daily_dimension__plan0.sql | 116 +++++------ ...values_query_with_metric_filter__plan0.sql | 4 +- ...ry_with_metric_filter__plan0_optimized.sql | 4 +- ...emantic_model_as_queried_metric__plan0.sql | 4 +- ...t_filter_with_conversion_metric__plan0.sql | 4 +- ...roup_by_has_local_entity_prefix__plan0.sql | 8 +- .../test_inner_query_multi_hop__plan0.sql | 86 ++++----- .../test_inner_query_single_hop__plan0.sql | 4 +- .../test_metric_filtered_by_itself__plan0.sql | 4 +- ...ric_with_metric_in_where_filter__plan0.sql | 4 +- ...mulative_metric_in_where_filter__plan0.sql | 4 +- ..._derived_metric_in_where_filter__plan0.sql | 4 +- ...with_multiple_metrics_in_filter__plan0.sql | 4 +- ...th_ratio_metric_in_where_filter__plan0.sql | 4 +- ...h_simple_metric_in_where_filter__plan0.sql | 4 +- ...dimensions_with_time_constraint__plan0.sql | 4 +- ...tric_time_with_other_dimensions__plan0.sql | 4 +- ...dimensions_with_time_constraint__plan0.xml | 182 +++++++++--------- ...tric_time_with_other_dimensions__plan0.xml | 176 ++++++++--------- ...conversion_metric_query_filters__plan0.sql | 8 +- ..._metric_query_filters__plan0_optimized.sql | 4 +- ..._metric_with_query_time_filters__plan0.sql | 4 +- ...spine_metric_predicate_pushdown__plan0.sql | 8 +- ...ic_time_filter_with_two_targets__plan0.sql | 4 +- ..._categorical_dimension_pushdown__plan0.sql | 4 +- ..._metric_with_query_time_filters__plan0.sql | 8 +- ...ry_with_metric_joins_and_filter__plan0.sql | 24 +-- ..._categorical_dimension_pushdown__plan0.sql | 4 +- .../DuckDB/test_skipped_pushdown__plan0.sql | 6 +- ...th_where_constraint_on_join_dim__plan0.sql | 4 +- .../test_join_to_scd_dimension__plan0.sql | 4 +- .../DuckDB/test_measure_constraint__plan0.sql | 8 +- ...multi_hop_through_scd_dimension__plan0.sql | 30 +-- ...test_multi_hop_to_scd_dimension__plan0.sql | 8 +- .../DuckDB/test_multihop_node__plan0.sql | 54 +++--- .../DuckDB/test_partitioned_join__plan0.sql | 4 +- 61 files changed, 955 insertions(+), 1043 deletions(-) diff --git a/metricflow/plan_conversion/dataflow_to_sql.py b/metricflow/plan_conversion/dataflow_to_sql.py index c2016fa1b5..045a247f26 100644 --- a/metricflow/plan_conversion/dataflow_to_sql.py +++ b/metricflow/plan_conversion/dataflow_to_sql.py @@ -25,15 +25,14 @@ MetadataInstance, MetricInstance, TimeDimensionInstance, + group_instances_by_type, ) from metricflow_semantics.mf_logging.formatting import indent from metricflow_semantics.mf_logging.lazy_formattable import LazyFormat from metricflow_semantics.model.semantic_manifest_lookup import SemanticManifestLookup -from metricflow_semantics.specs.column_assoc import ( - ColumnAssociationResolver, -) +from metricflow_semantics.specs.column_assoc import ColumnAssociation, ColumnAssociationResolver from metricflow_semantics.specs.group_by_metric_spec import GroupByMetricSpec -from metricflow_semantics.specs.instance_spec import InstanceSpec +from metricflow_semantics.specs.instance_spec import InstanceSpec, LinkableInstanceSpec from metricflow_semantics.specs.measure_spec import MeasureSpec from metricflow_semantics.specs.metadata_spec import MetadataSpec from metricflow_semantics.specs.metric_spec import MetricSpec @@ -72,7 +71,6 @@ from metricflow.plan_conversion.convert_to_sql_plan import ConvertToSqlPlanResult from metricflow.plan_conversion.instance_converters import ( AddGroupByMetric, - AddLinkToLinkableElements, AddMetadata, AddMetrics, AliasAggregatedMeasures, @@ -229,7 +227,7 @@ def convert_to_sql_query_plan( sql_node = optimizer.optimize(sql_node) logger.debug( LazyFormat( - lambda: f"After applying {optimizer.__class__.__name__}, the SQL query plan is:\n" + lambda: f"After applying optimizer {optimizer.__class__.__name__}, the SQL query plan is:\n" f"{indent(sql_node.structure_text())}" ) ) @@ -456,31 +454,58 @@ def visit_join_over_time_range_node(self, node: JoinOverTimeRangeNode) -> SqlDat ) def visit_join_on_entities_node(self, node: JoinOnEntitiesNode) -> SqlDataSet: - """Generates the query that realizes the behavior of the JoinToStandardOutputNode.""" - # Keep a mapping between the table aliases that would be used in the query and the MDO instances in that source. - # e.g. when building "FROM from_table a JOIN right_table b", the value for key "a" would be the instances in - # "from_table" - table_alias_to_instance_set: OrderedDict[str, InstanceSet] = OrderedDict() - - # Convert the dataflow from the left node to a DataSet and add context for it to table_alias_to_instance_set - # A DataSet is a bundle of the SQL query (in object form) and the MDO instances that the SQL query contains. + """Generates the query that realizes the behavior of the JoinOnEntitiesNode.""" from_data_set = node.left_node.accept(self) from_data_set_alias = self._next_unique_table_alias() - table_alias_to_instance_set[from_data_set_alias] = from_data_set.instance_set - # Build the join descriptions for the SqlQueryPlan - different from node.join_descriptions which are the join - # descriptions from the dataflow plan. - sql_join_descs: List[SqlJoinDescription] = [] + # TODO: make prettier + def build_columns(spec: LinkableInstanceSpec) -> Tuple[ColumnAssociation]: + return (self._column_association_resolver.resolve_spec(spec),) + + def build_select_column( + table_alias: str, original_instance: MdoInstance, new_instance: MdoInstance + ) -> SqlSelectColumn: + """Build new select column using the old column name as the expr and the new column name as the alias. + + Example: "country AS user_id__country" + """ + return SqlSelectColumn( + expr=SqlColumnReferenceExpression.from_table_and_column_names( + table_alias=table_alias, column_name=original_instance.associated_column.column_name + ), + column_alias=new_instance.associated_column.column_name, + ) + + # Change the aggregation state for the measures to be partially aggregated if it was previously aggregated + # since we removed the entities and added the dimensions. The dimensions could have the same value for + # multiple rows, so we'll need to re-aggregate. + from_data_set_output_instance_set = from_data_set.instance_set.transform( + # TODO: is this filter doing anything? seems like no? + FilterElements(include_specs=from_data_set.instance_set.spec_set) + ).transform( + ChangeMeasureAggregationState( + { + AggregationState.NON_AGGREGATED: AggregationState.NON_AGGREGATED, + AggregationState.COMPLETE: AggregationState.PARTIAL, + AggregationState.PARTIAL: AggregationState.PARTIAL, + } + ) + ) + instances_to_build_simple_select_columns_for = OrderedDict( + {from_data_set_alias: from_data_set_output_instance_set} + ) - # The dataflow plan describes how the data sets coming from the parent nodes should be joined together. Use - # those descriptions to convert them to join descriptions for the SQL query plan. + # Build SQL join description, instance set, and select columns for each join target. + output_instance_set = from_data_set_output_instance_set + select_columns: Tuple[SqlSelectColumn, ...] = () + sql_join_descs: List[SqlJoinDescription] = [] for join_description in node.join_targets: join_on_entity = join_description.join_on_entity - - right_node_to_join: DataflowPlanNode = join_description.join_node + right_node_to_join = join_description.join_node right_data_set: SqlDataSet = right_node_to_join.accept(self) right_data_set_alias = self._next_unique_table_alias() + # Build join description. sql_join_desc = SqlQueryPlanJoinBuilder.make_base_output_join_description( left_data_set=AnnotatedSqlDataSet(data_set=from_data_set, alias=from_data_set_alias), right_data_set=AnnotatedSqlDataSet(data_set=right_data_set, alias=right_data_set_alias), @@ -495,50 +520,44 @@ def visit_join_on_entities_node(self, node: JoinOnEntitiesNode) -> SqlDataSet: # e.g. a data set has the dimension "listing__country_latest" and "listing" is a primary entity in the # data set. The next step would create an instance like "listing__listing__country_latest" without this # filter. - right_data_set_instance_set_filtered = FilterLinkableInstancesWithLeadingLink( - entity_link=join_on_entity, - ).transform(right_data_set.instance_set) - - # After the right data set is joined to the "from" data set, we need to change the links for some of the - # instances that represent the right data set. For example, if the "from" data set contains the "bookings" - # measure instance and the right dataset contains the "country" dimension instance, then after the join, - # the output data set should have the "country" dimension instance with the "user_id" entity link - # (if "user_id" equality was the join condition). "country" -> "user_id__country" - right_data_set_instance_set_after_join = right_data_set_instance_set_filtered.transform( - AddLinkToLinkableElements(join_on_entity=join_on_entity) + # TODO: test if this transformation is necessary and remove it if not. This adds a lot of clutter to the function. + right_instance_set_filtered = FilterLinkableInstancesWithLeadingLink(join_on_entity).transform( + right_data_set.instance_set ) + + # After the right data set is joined, we need to change the links to indicate that they a join was used to + # satisfy them. For example, if the right dataset contains the "country" dimension, and "user_id" is the + # join_on_entity, then the joined data set should have the "user__country" dimension. + new_instances: Tuple[MdoInstance, ...] = () + for original_instance in right_instance_set_filtered.linkable_instances: + # Is this necessary? Does it even work? i.e. diff types here + if original_instance.spec == join_on_entity: + continue + new_instance = original_instance.with_entity_prefix( + join_on_entity.reference, column_association_resolver=self._column_association_resolver + ) + select_column = build_select_column( + table_alias=right_data_set_alias, original_instance=original_instance, new_instance=new_instance + ) + new_instances += (new_instance,) + select_columns += (select_column,) + right_instance_set_after_join = group_instances_by_type(new_instances) else: - right_data_set_instance_set_after_join = right_data_set.instance_set - table_alias_to_instance_set[right_data_set_alias] = right_data_set_instance_set_after_join + right_instance_set_after_join = right_data_set.instance_set + instances_to_build_simple_select_columns_for[right_data_set_alias] = right_instance_set_after_join - from_data_set_output_instance_set = from_data_set.instance_set.transform( - FilterElements(include_specs=from_data_set.instance_set.spec_set) - ) + output_instance_set = InstanceSet.merge([output_instance_set, right_instance_set_after_join]) - # Change the aggregation state for the measures to be partially aggregated if it was previously aggregated - # since we removed the entities and added the dimensions. The dimensions could have the same value for - # multiple rows, so we'll need to re-aggregate. - from_data_set_output_instance_set = from_data_set_output_instance_set.transform( - ChangeMeasureAggregationState( - { - AggregationState.NON_AGGREGATED: AggregationState.NON_AGGREGATED, - AggregationState.COMPLETE: AggregationState.PARTIAL, - AggregationState.PARTIAL: AggregationState.PARTIAL, - } - ) + select_columns += create_select_columns_for_instance_sets( + column_resolver=self._column_association_resolver, + table_alias_to_instance_set=instances_to_build_simple_select_columns_for, ) - - table_alias_to_instance_set[from_data_set_alias] = from_data_set_output_instance_set - - # Construct the data set that contains the updated instances and the SQL nodes that should go in the various - # clauses. return SqlDataSet( - instance_set=InstanceSet.merge(list(table_alias_to_instance_set.values())), + # TODO: Should SqlDataSet have a map like {instance: column}? Trying to match them is a pain in the butt. + instance_set=output_instance_set, sql_select_node=SqlSelectStatementNode.create( description=node.description, - select_columns=create_select_columns_for_instance_sets( - self._column_association_resolver, table_alias_to_instance_set - ), + select_columns=select_columns, from_source=from_data_set.checked_sql_select_node, from_source_alias=from_data_set_alias, join_descs=tuple(sql_join_descs), diff --git a/metricflow/plan_conversion/instance_converters.py b/metricflow/plan_conversion/instance_converters.py index d49457a637..495038bd1e 100644 --- a/metricflow/plan_conversion/instance_converters.py +++ b/metricflow/plan_conversion/instance_converters.py @@ -8,7 +8,7 @@ from itertools import chain from typing import Dict, List, Optional, Sequence, Tuple -from dbt_semantic_interfaces.references import EntityReference, MetricReference, SemanticModelReference +from dbt_semantic_interfaces.references import MetricReference, SemanticModelReference from dbt_semantic_interfaces.type_enums.aggregation_type import AggregationType from dbt_semantic_interfaces.type_enums.date_part import DatePart from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity @@ -29,13 +29,10 @@ from metricflow_semantics.model.semantics.metric_lookup import MetricLookup from metricflow_semantics.model.semantics.semantic_model_lookup import SemanticModelLookup from metricflow_semantics.specs.column_assoc import ColumnAssociationResolver -from metricflow_semantics.specs.dimension_spec import DimensionSpec -from metricflow_semantics.specs.entity_spec import EntitySpec, LinklessEntitySpec -from metricflow_semantics.specs.group_by_metric_spec import GroupByMetricSpec +from metricflow_semantics.specs.entity_spec import LinklessEntitySpec from metricflow_semantics.specs.instance_spec import InstanceSpec, LinkableInstanceSpec from metricflow_semantics.specs.measure_spec import MeasureSpec, MetricInputMeasureSpec from metricflow_semantics.specs.spec_set import InstanceSpecSet -from metricflow_semantics.specs.time_dimension_spec import TimeDimensionSpec from more_itertools import bucket from metricflow.dataflow.nodes.join_to_base import ValidityWindowJoinDescription @@ -387,118 +384,14 @@ def transform(self, instance_set: InstanceSet) -> Optional[ValidityWindowJoinDes return None -class AddLinkToLinkableElements(InstanceSetTransform[InstanceSet]): - """Return a new instance set where the all linkable elements in the set have a new link added. - - e.g. "country" -> "user_id__country" after a data set has been joined by entity. - """ - - def __init__(self, join_on_entity: LinklessEntitySpec) -> None: # noqa: D107 - self._join_on_entity = join_on_entity - - def transform(self, instance_set: InstanceSet) -> InstanceSet: # noqa: D102 - assert len(instance_set.metric_instances) == 0, "Can't add links to instance sets with metrics" - assert len(instance_set.measure_instances) == 0, "Can't add links to instance sets with measures" - - # Handle dimension instances - dimension_instances_with_additional_link = [] - for dimension_instance in instance_set.dimension_instances: - # The new dimension spec should include the join on entity. - transformed_dimension_spec_from_right = DimensionSpec( - element_name=dimension_instance.spec.element_name, - entity_links=self._join_on_entity.as_linkless_prefix + dimension_instance.spec.entity_links, - ) - dimension_instances_with_additional_link.append( - DimensionInstance( - associated_columns=dimension_instance.associated_columns, - defined_from=dimension_instance.defined_from, - spec=transformed_dimension_spec_from_right, - ) - ) - - # Handle time dimension instances - time_dimension_instances_with_additional_link = [] - for time_dimension_instance in instance_set.time_dimension_instances: - # The new dimension spec should include the join on entity. - transformed_time_dimension_spec_from_right = TimeDimensionSpec( - element_name=time_dimension_instance.spec.element_name, - entity_links=( - (EntityReference(element_name=self._join_on_entity.element_name),) - + time_dimension_instance.spec.entity_links - ), - time_granularity=time_dimension_instance.spec.time_granularity, - date_part=time_dimension_instance.spec.date_part, - ) - time_dimension_instances_with_additional_link.append( - TimeDimensionInstance( - associated_columns=time_dimension_instance.associated_columns, - defined_from=time_dimension_instance.defined_from, - spec=transformed_time_dimension_spec_from_right, - ) - ) - - # Handle entity instances - entity_instances_with_additional_link = [] - for entity_instance in instance_set.entity_instances: - # Don't include adding the entity link to the same entity. - # Otherwise, you would create "user_id__user_id", which is confusing. - if entity_instance.spec == self._join_on_entity: - continue - # The new entity spec should include the join on entity. - transformed_entity_spec_from_right = EntitySpec( - element_name=entity_instance.spec.element_name, - entity_links=self._join_on_entity.as_linkless_prefix + entity_instance.spec.entity_links, - ) - entity_instances_with_additional_link.append( - EntityInstance( - associated_columns=entity_instance.associated_columns, - defined_from=entity_instance.defined_from, - spec=transformed_entity_spec_from_right, - ) - ) - - # Handle group by metric instances - group_by_metric_instances_with_additional_link = [] - for group_by_metric_instance in instance_set.group_by_metric_instances: - transformed_group_by_metric_spec_from_right = GroupByMetricSpec( - element_name=group_by_metric_instance.spec.element_name, - entity_links=self._join_on_entity.as_linkless_prefix + group_by_metric_instance.spec.entity_links, - metric_subquery_entity_links=group_by_metric_instance.spec.metric_subquery_entity_links, - ) - group_by_metric_instances_with_additional_link.append( - GroupByMetricInstance( - associated_columns=group_by_metric_instance.associated_columns, - defined_from=group_by_metric_instance.defined_from, - spec=transformed_group_by_metric_spec_from_right, - ) - ) - - return InstanceSet( - measure_instances=(), - dimension_instances=tuple(dimension_instances_with_additional_link), - time_dimension_instances=tuple(time_dimension_instances_with_additional_link), - entity_instances=tuple(entity_instances_with_additional_link), - group_by_metric_instances=tuple(group_by_metric_instances_with_additional_link), - metric_instances=(), - metadata_instances=(), - ) - - class FilterLinkableInstancesWithLeadingLink(InstanceSetTransform[InstanceSet]): """Return an instance set with the elements that have a specified leading link removed. e.g. Remove "listing__country" if the specified link is "listing". """ - def __init__( - self, - entity_link: LinklessEntitySpec, - ) -> None: - """Constructor. - - Args: - entity_link: Remove elements with this link as the first element in "entity_links" - """ + def __init__(self, entity_link: LinklessEntitySpec) -> None: + """Remove elements with this link as the first element in "entity_links".""" self._entity_link = entity_link def _should_pass(self, linkable_spec: LinkableInstanceSpec) -> bool: diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_simple_metric_with_multi_hop_custom_granularity__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_simple_metric_with_multi_hop_custom_granularity__plan0.sql index dc337169ee..fb56a0ee0b 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_simple_metric_with_multi_hop_custom_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_simple_metric_with_multi_hop_custom_granularity__plan0.sql @@ -22,9 +22,9 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.ds_partitioned__day AS ds_partitioned__day - , subq_9.user__ds__day AS listing__user__ds__day + subq_9.user__ds__day AS listing__user__ds__day , subq_9.user__ds_partitioned__day AS listing__user__ds_partitioned__day + , subq_2.ds_partitioned__day AS ds_partitioned__day , subq_2.listing AS listing , subq_2.bookings AS bookings FROM ( @@ -238,61 +238,7 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_4.ds__day AS ds__day - , subq_4.ds__week AS ds__week - , subq_4.ds__month AS ds__month - , subq_4.ds__quarter AS ds__quarter - , subq_4.ds__year AS ds__year - , subq_4.ds__extract_year AS ds__extract_year - , subq_4.ds__extract_quarter AS ds__extract_quarter - , subq_4.ds__extract_month AS ds__extract_month - , subq_4.ds__extract_day AS ds__extract_day - , subq_4.ds__extract_dow AS ds__extract_dow - , subq_4.ds__extract_doy AS ds__extract_doy - , subq_4.created_at__day AS created_at__day - , subq_4.created_at__week AS created_at__week - , subq_4.created_at__month AS created_at__month - , subq_4.created_at__quarter AS created_at__quarter - , subq_4.created_at__year AS created_at__year - , subq_4.created_at__extract_year AS created_at__extract_year - , subq_4.created_at__extract_quarter AS created_at__extract_quarter - , subq_4.created_at__extract_month AS created_at__extract_month - , subq_4.created_at__extract_day AS created_at__extract_day - , subq_4.created_at__extract_dow AS created_at__extract_dow - , subq_4.created_at__extract_doy AS created_at__extract_doy - , subq_4.listing__ds__day AS listing__ds__day - , subq_4.listing__ds__week AS listing__ds__week - , subq_4.listing__ds__month AS listing__ds__month - , subq_4.listing__ds__quarter AS listing__ds__quarter - , subq_4.listing__ds__year AS listing__ds__year - , subq_4.listing__ds__extract_year AS listing__ds__extract_year - , subq_4.listing__ds__extract_quarter AS listing__ds__extract_quarter - , subq_4.listing__ds__extract_month AS listing__ds__extract_month - , subq_4.listing__ds__extract_day AS listing__ds__extract_day - , subq_4.listing__ds__extract_dow AS listing__ds__extract_dow - , subq_4.listing__ds__extract_doy AS listing__ds__extract_doy - , subq_4.listing__created_at__day AS listing__created_at__day - , subq_4.listing__created_at__week AS listing__created_at__week - , subq_4.listing__created_at__month AS listing__created_at__month - , subq_4.listing__created_at__quarter AS listing__created_at__quarter - , subq_4.listing__created_at__year AS listing__created_at__year - , subq_4.listing__created_at__extract_year AS listing__created_at__extract_year - , subq_4.listing__created_at__extract_quarter AS listing__created_at__extract_quarter - , subq_4.listing__created_at__extract_month AS listing__created_at__extract_month - , subq_4.listing__created_at__extract_day AS listing__created_at__extract_day - , subq_4.listing__created_at__extract_dow AS listing__created_at__extract_dow - , subq_4.listing__created_at__extract_doy AS listing__created_at__extract_doy - , subq_4.metric_time__day AS metric_time__day - , subq_4.metric_time__week AS metric_time__week - , subq_4.metric_time__month AS metric_time__month - , subq_4.metric_time__quarter AS metric_time__quarter - , subq_4.metric_time__year AS metric_time__year - , subq_4.metric_time__extract_year AS metric_time__extract_year - , subq_4.metric_time__extract_quarter AS metric_time__extract_quarter - , subq_4.metric_time__extract_month AS metric_time__extract_month - , subq_4.metric_time__extract_day AS metric_time__extract_day - , subq_4.metric_time__extract_dow AS metric_time__extract_dow - , subq_4.metric_time__extract_doy AS metric_time__extract_doy + subq_7.home_state AS user__home_state , subq_7.ds__day AS user__ds__day , subq_7.ds__week AS user__ds__week , subq_7.ds__month AS user__ds__month @@ -391,6 +337,61 @@ FROM ( , subq_7.metric_time__extract_day AS user__metric_time__extract_day , subq_7.metric_time__extract_dow AS user__metric_time__extract_dow , subq_7.metric_time__extract_doy AS user__metric_time__extract_doy + , subq_4.ds__day AS ds__day + , subq_4.ds__week AS ds__week + , subq_4.ds__month AS ds__month + , subq_4.ds__quarter AS ds__quarter + , subq_4.ds__year AS ds__year + , subq_4.ds__extract_year AS ds__extract_year + , subq_4.ds__extract_quarter AS ds__extract_quarter + , subq_4.ds__extract_month AS ds__extract_month + , subq_4.ds__extract_day AS ds__extract_day + , subq_4.ds__extract_dow AS ds__extract_dow + , subq_4.ds__extract_doy AS ds__extract_doy + , subq_4.created_at__day AS created_at__day + , subq_4.created_at__week AS created_at__week + , subq_4.created_at__month AS created_at__month + , subq_4.created_at__quarter AS created_at__quarter + , subq_4.created_at__year AS created_at__year + , subq_4.created_at__extract_year AS created_at__extract_year + , subq_4.created_at__extract_quarter AS created_at__extract_quarter + , subq_4.created_at__extract_month AS created_at__extract_month + , subq_4.created_at__extract_day AS created_at__extract_day + , subq_4.created_at__extract_dow AS created_at__extract_dow + , subq_4.created_at__extract_doy AS created_at__extract_doy + , subq_4.listing__ds__day AS listing__ds__day + , subq_4.listing__ds__week AS listing__ds__week + , subq_4.listing__ds__month AS listing__ds__month + , subq_4.listing__ds__quarter AS listing__ds__quarter + , subq_4.listing__ds__year AS listing__ds__year + , subq_4.listing__ds__extract_year AS listing__ds__extract_year + , subq_4.listing__ds__extract_quarter AS listing__ds__extract_quarter + , subq_4.listing__ds__extract_month AS listing__ds__extract_month + , subq_4.listing__ds__extract_day AS listing__ds__extract_day + , subq_4.listing__ds__extract_dow AS listing__ds__extract_dow + , subq_4.listing__ds__extract_doy AS listing__ds__extract_doy + , subq_4.listing__created_at__day AS listing__created_at__day + , subq_4.listing__created_at__week AS listing__created_at__week + , subq_4.listing__created_at__month AS listing__created_at__month + , subq_4.listing__created_at__quarter AS listing__created_at__quarter + , subq_4.listing__created_at__year AS listing__created_at__year + , subq_4.listing__created_at__extract_year AS listing__created_at__extract_year + , subq_4.listing__created_at__extract_quarter AS listing__created_at__extract_quarter + , subq_4.listing__created_at__extract_month AS listing__created_at__extract_month + , subq_4.listing__created_at__extract_day AS listing__created_at__extract_day + , subq_4.listing__created_at__extract_dow AS listing__created_at__extract_dow + , subq_4.listing__created_at__extract_doy AS listing__created_at__extract_doy + , subq_4.metric_time__day AS metric_time__day + , subq_4.metric_time__week AS metric_time__week + , subq_4.metric_time__month AS metric_time__month + , subq_4.metric_time__quarter AS metric_time__quarter + , subq_4.metric_time__year AS metric_time__year + , subq_4.metric_time__extract_year AS metric_time__extract_year + , subq_4.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_4.metric_time__extract_month AS metric_time__extract_month + , subq_4.metric_time__extract_day AS metric_time__extract_day + , subq_4.metric_time__extract_dow AS metric_time__extract_dow + , subq_4.metric_time__extract_doy AS metric_time__extract_doy , subq_4.listing AS listing , subq_4.user AS user , subq_4.listing__user AS listing__user @@ -400,7 +401,6 @@ FROM ( , subq_4.listing__country_latest AS listing__country_latest , subq_4.listing__is_lux_latest AS listing__is_lux_latest , subq_4.listing__capacity_latest AS listing__capacity_latest - , subq_7.home_state AS user__home_state , subq_4.listings AS listings , subq_4.largest_listing AS largest_listing , subq_4.smallest_listing AS smallest_listing diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0.sql index 08fdfa6034..518be50ca5 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0.sql @@ -12,8 +12,8 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_1.listing AS listing - , subq_3.country_latest AS listing__country_latest + subq_3.country_latest AS listing__country_latest + , subq_1.listing AS listing , subq_1.bookings AS bookings FROM ( -- Pass Only Elements: ['bookings', 'listing'] diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql index d37cd06bd3..87475628d3 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql @@ -31,9 +31,9 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.ds__day AS ds__day + subq_5.country_latest AS listing__country_latest + , subq_2.ds__day AS ds__day , subq_2.listing AS listing - , subq_5.country_latest AS listing__country_latest , subq_2.bookings AS bookings FROM ( -- Pass Only Elements: ['bookings', 'ds__day', 'listing'] @@ -405,9 +405,9 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_12.ds__day AS ds__day + subq_15.country_latest AS listing__country_latest + , subq_12.ds__day AS ds__day , subq_12.listing AS listing - , subq_15.country_latest AS listing__country_latest , subq_12.views AS views FROM ( -- Pass Only Elements: ['views', 'ds__day', 'listing'] diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql index c7aabe5705..868e41e121 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql @@ -13,8 +13,8 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_1.listing AS listing - , subq_3.country_latest AS listing__country_latest + subq_3.country_latest AS listing__country_latest + , subq_1.listing AS listing , subq_1.bookings AS bookings , subq_1.bookers AS bookers FROM ( diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0.sql index 069df1629d..dfbf89867b 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0.sql @@ -12,8 +12,8 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_1.listing AS listing - , subq_3.country_latest AS listing__country_latest + subq_3.country_latest AS listing__country_latest + , subq_1.listing AS listing , subq_1.booking_value AS booking_value FROM ( -- Pass Only Elements: ['booking_value', 'listing'] diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0.sql index ed1028fb88..a254ce28b8 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0.sql @@ -64,7 +64,8 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_0.ds__day AS ds__day + subq_2.home_state_latest AS user__home_state_latest + , subq_0.ds__day AS ds__day , subq_0.ds__week AS ds__week , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter @@ -117,7 +118,6 @@ FROM ( , subq_0.listing__country_latest AS listing__country_latest , subq_0.listing__is_lux_latest AS listing__is_lux_latest , subq_0.listing__capacity_latest AS listing__capacity_latest - , subq_2.home_state_latest AS user__home_state_latest , subq_0.listings AS listings , subq_0.largest_listing AS largest_listing , subq_0.smallest_listing AS smallest_listing diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0_optimized.sql index c4e57d3c86..08f5aa9a14 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0_optimized.sql @@ -5,8 +5,8 @@ SELECT FROM ( -- Join Standard Outputs SELECT - listings_latest_src_28000.country AS listing__country_latest - , users_latest_src_28000.home_state_latest AS user__home_state_latest + users_latest_src_28000.home_state_latest AS user__home_state_latest + , listings_latest_src_28000.country AS listing__country_latest FROM ***************************.dim_listings_latest listings_latest_src_28000 FULL OUTER JOIN ***************************.dim_users_latest users_latest_src_28000 diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0.sql index 0962aa9958..e4d9c4cec1 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0.sql @@ -5,7 +5,8 @@ SELECT FROM ( -- Join Standard Outputs SELECT - subq_0.ds__day AS ds__day + subq_2.home_state_latest AS user__home_state_latest + , subq_0.ds__day AS ds__day , subq_0.ds__week AS ds__week , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter @@ -58,7 +59,6 @@ FROM ( , subq_0.listing__country_latest AS listing__country_latest , subq_0.listing__is_lux_latest AS listing__is_lux_latest , subq_0.listing__capacity_latest AS listing__capacity_latest - , subq_2.home_state_latest AS user__home_state_latest , subq_0.listings AS listings , subq_0.largest_listing AS largest_listing , subq_0.smallest_listing AS smallest_listing diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0.sql index f3ed9fa304..9607966cf1 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0.sql @@ -1,8 +1,8 @@ -- Join Standard Outputs SELECT - subq_1.listing AS listing - , subq_3.country_latest AS listing__country_latest + subq_3.country_latest AS listing__country_latest , subq_5.country_latest AS listing__country_latest + , subq_1.listing AS listing , subq_1.bookings AS bookings FROM ( -- Pass Only Elements: ['bookings', 'listing'] diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0_optimized.sql b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0_optimized.sql index 7d9c669f54..a880de7068 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0_optimized.sql @@ -1,8 +1,8 @@ -- Join Standard Outputs SELECT - subq_7.listing AS listing - , subq_9.country_latest AS listing__country_latest + subq_9.country_latest AS listing__country_latest , subq_11.country_latest AS listing__country_latest + , subq_7.listing AS listing , subq_7.bookings AS bookings FROM ( -- Read Elements From Semantic Model 'bookings_source' diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node__plan0.xml index 41a0d7fadf..0977ce5781 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node__plan0.xml @@ -35,13 +35,13 @@ - - + - + - + + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml index 9689428e69..d46d963d11 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml @@ -110,22 +110,22 @@ - - + + - + - + - + @@ -1823,22 +1823,22 @@ - - + + - + - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.xml index b7e81ad415..224fa33647 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.xml @@ -41,14 +41,14 @@ - - - - - - - - + + + + + + + + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_simple_expr__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_simple_expr__plan0.xml index c4e2b19ee7..f693d083f3 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_simple_expr__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_simple_expr__plan0.xml @@ -39,14 +39,14 @@ - - + - + + - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimension_with_joined_where_constraint__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimension_with_joined_where_constraint__plan0.xml index 666304faf3..074fb50317 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimension_with_joined_where_constraint__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimension_with_joined_where_constraint__plan0.xml @@ -204,206 +204,206 @@ - - - - - - - - - + + + + + + + + + + + + + + - + - - - - + + - + - + - - - - - - + + + + + + + + - + - - - - - - - + + - + - + - + - + - + - - - - - + - - + + + + + + - + - - - + - - + + + + - + - + - + - + - + - + - + - + - + - + + + + + + - + - + - + - + - - - - - - + - + - - - - - - - - - - - + - - + + + + + + + + + + + + - + - + - - + + - + - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml index 9c1b393a33..2d8e288ee1 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml @@ -16,190 +16,190 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - - - - + + + + + + + + + + + - + - + - + - + - + - - - - - - - - - - - + - - + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + + + + + + - + - + - + - + - - - - - - + - + - - - - - - - - + - - + + + + + + + + + - + - + - - + + - + - + - + diff --git a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_join_node__plan0.xml b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_join_node__plan0.xml index 04ff272c2e..b57d69bf27 100644 --- a/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_join_node__plan0.xml +++ b/tests_metricflow/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_multi_join_node__plan0.xml @@ -2,12 +2,12 @@ - + + - - - - + + + @@ -580,8 +580,8 @@ - - + + diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0.sql index 4569d672d5..1cb582d6b5 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0.sql @@ -38,9 +38,9 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.listing AS listing + subq_5.is_lux_latest AS listing__is_lux_latest + , subq_2.listing AS listing , subq_2.booking__is_instant AS booking__is_instant - , subq_5.is_lux_latest AS listing__is_lux_latest , subq_2.average_booking_value AS average_booking_value FROM ( -- Pass Only Elements: ['average_booking_value', 'booking__is_instant', 'listing'] @@ -418,9 +418,9 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_14.listing AS listing + subq_17.is_lux_latest AS listing__is_lux_latest + , subq_14.listing AS listing , subq_14.booking__is_instant AS booking__is_instant - , subq_17.is_lux_latest AS listing__is_lux_latest , subq_14.bookings AS bookings FROM ( -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing'] diff --git a/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimension_values_with_a_join_and_a_filter__plan0.sql b/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimension_values_with_a_join_and_a_filter__plan0.sql index d736ad0d03..d1d3afb12c 100644 --- a/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimension_values_with_a_join_and_a_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimension_values_with_a_join_and_a_filter__plan0.sql @@ -65,7 +65,8 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_0.ds__day AS ds__day + subq_2.home_state_latest AS user__home_state_latest + , subq_0.ds__day AS ds__day , subq_0.ds__week AS ds__week , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter @@ -118,7 +119,6 @@ FROM ( , subq_0.listing__country_latest AS listing__country_latest , subq_0.listing__is_lux_latest AS listing__is_lux_latest , subq_0.listing__capacity_latest AS listing__capacity_latest - , subq_2.home_state_latest AS user__home_state_latest , subq_0.listings AS listings , subq_0.largest_listing AS largest_listing , subq_0.smallest_listing AS smallest_listing diff --git a/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql index e54eaffeb6..8710b3d2f6 100644 --- a/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimension_values_with_a_join_and_a_filter__plan0_optimized.sql @@ -6,8 +6,8 @@ SELECT FROM ( -- Join Standard Outputs SELECT - listings_latest_src_28000.is_lux AS listing__is_lux_latest - , users_latest_src_28000.home_state_latest AS user__home_state_latest + users_latest_src_28000.home_state_latest AS user__home_state_latest + , listings_latest_src_28000.is_lux AS listing__is_lux_latest FROM ***************************.dim_listings_latest listings_latest_src_28000 FULL OUTER JOIN ***************************.dim_users_latest users_latest_src_28000 diff --git a/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0.sql b/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0.sql index 0962aa9958..e4d9c4cec1 100644 --- a/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0.sql +++ b/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0.sql @@ -5,7 +5,8 @@ SELECT FROM ( -- Join Standard Outputs SELECT - subq_0.ds__day AS ds__day + subq_2.home_state_latest AS user__home_state_latest + , subq_0.ds__day AS ds__day , subq_0.ds__week AS ds__week , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter @@ -58,7 +59,6 @@ FROM ( , subq_0.listing__country_latest AS listing__country_latest , subq_0.listing__is_lux_latest AS listing__is_lux_latest , subq_0.listing__capacity_latest AS listing__capacity_latest - , subq_2.home_state_latest AS user__home_state_latest , subq_0.listings AS listings , subq_0.largest_listing AS largest_listing , subq_0.smallest_listing AS smallest_listing diff --git a/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimension_values_with_a_join_and_a_filter__plan0.xml b/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimension_values_with_a_join_and_a_filter__plan0.xml index 2c33124008..31ec4e8cdb 100644 --- a/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimension_values_with_a_join_and_a_filter__plan0.xml +++ b/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimension_values_with_a_join_and_a_filter__plan0.xml @@ -208,206 +208,206 @@ - - - - - - - - - + + + + + + + + + + + + + + - + - - - - + + - + - + - - - - - - + + + + + + + + - + - - - - - - - + + - + - + - + - + - + - - - - - + - - + + + + + + - + - - - + - - + + + + - + - + - + - + - + - + - + - + - + - + + + + + + - + - + - + - + - - - - - - + - + - - - - - - - - - - - + - - + + + + + + + + + + + + - + - + - - + + - + - + - + diff --git a/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml b/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml index 9c1b393a33..2d8e288ee1 100644 --- a/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml +++ b/tests_metricflow/snapshots/test_distinct_values_to_sql.py/SqlQueryPlan/test_dimensions_requiring_join__plan0.xml @@ -16,190 +16,190 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - - - - + + + + + + + + + + + - + - + - + - + - + - - - - - - - - - - - + - - + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + + + + + + - + - + - + - + - - - - - - + - + - - - - - - - - + - - + + + + + + + + + - + - + - - + + - + - + - + diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql index c2505892cd..1f119872ca 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_simple_metric_with_joined_sub_daily_dimension__plan0.sql @@ -15,9 +15,9 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.ds_partitioned__day AS ds_partitioned__day - , subq_9.user__ds_partitioned__day AS listing__user__ds_partitioned__day + subq_9.user__ds_partitioned__day AS listing__user__ds_partitioned__day , subq_9.user__bio_added_ts__minute AS listing__user__bio_added_ts__minute + , subq_2.ds_partitioned__day AS ds_partitioned__day , subq_2.listing AS listing , subq_2.bookings AS bookings FROM ( @@ -231,61 +231,7 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_4.ds__day AS ds__day - , subq_4.ds__week AS ds__week - , subq_4.ds__month AS ds__month - , subq_4.ds__quarter AS ds__quarter - , subq_4.ds__year AS ds__year - , subq_4.ds__extract_year AS ds__extract_year - , subq_4.ds__extract_quarter AS ds__extract_quarter - , subq_4.ds__extract_month AS ds__extract_month - , subq_4.ds__extract_day AS ds__extract_day - , subq_4.ds__extract_dow AS ds__extract_dow - , subq_4.ds__extract_doy AS ds__extract_doy - , subq_4.created_at__day AS created_at__day - , subq_4.created_at__week AS created_at__week - , subq_4.created_at__month AS created_at__month - , subq_4.created_at__quarter AS created_at__quarter - , subq_4.created_at__year AS created_at__year - , subq_4.created_at__extract_year AS created_at__extract_year - , subq_4.created_at__extract_quarter AS created_at__extract_quarter - , subq_4.created_at__extract_month AS created_at__extract_month - , subq_4.created_at__extract_day AS created_at__extract_day - , subq_4.created_at__extract_dow AS created_at__extract_dow - , subq_4.created_at__extract_doy AS created_at__extract_doy - , subq_4.listing__ds__day AS listing__ds__day - , subq_4.listing__ds__week AS listing__ds__week - , subq_4.listing__ds__month AS listing__ds__month - , subq_4.listing__ds__quarter AS listing__ds__quarter - , subq_4.listing__ds__year AS listing__ds__year - , subq_4.listing__ds__extract_year AS listing__ds__extract_year - , subq_4.listing__ds__extract_quarter AS listing__ds__extract_quarter - , subq_4.listing__ds__extract_month AS listing__ds__extract_month - , subq_4.listing__ds__extract_day AS listing__ds__extract_day - , subq_4.listing__ds__extract_dow AS listing__ds__extract_dow - , subq_4.listing__ds__extract_doy AS listing__ds__extract_doy - , subq_4.listing__created_at__day AS listing__created_at__day - , subq_4.listing__created_at__week AS listing__created_at__week - , subq_4.listing__created_at__month AS listing__created_at__month - , subq_4.listing__created_at__quarter AS listing__created_at__quarter - , subq_4.listing__created_at__year AS listing__created_at__year - , subq_4.listing__created_at__extract_year AS listing__created_at__extract_year - , subq_4.listing__created_at__extract_quarter AS listing__created_at__extract_quarter - , subq_4.listing__created_at__extract_month AS listing__created_at__extract_month - , subq_4.listing__created_at__extract_day AS listing__created_at__extract_day - , subq_4.listing__created_at__extract_dow AS listing__created_at__extract_dow - , subq_4.listing__created_at__extract_doy AS listing__created_at__extract_doy - , subq_4.metric_time__day AS metric_time__day - , subq_4.metric_time__week AS metric_time__week - , subq_4.metric_time__month AS metric_time__month - , subq_4.metric_time__quarter AS metric_time__quarter - , subq_4.metric_time__year AS metric_time__year - , subq_4.metric_time__extract_year AS metric_time__extract_year - , subq_4.metric_time__extract_quarter AS metric_time__extract_quarter - , subq_4.metric_time__extract_month AS metric_time__extract_month - , subq_4.metric_time__extract_day AS metric_time__extract_day - , subq_4.metric_time__extract_dow AS metric_time__extract_dow - , subq_4.metric_time__extract_doy AS metric_time__extract_doy + subq_7.home_state AS user__home_state , subq_7.ds__day AS user__ds__day , subq_7.ds__week AS user__ds__week , subq_7.ds__month AS user__ds__month @@ -384,6 +330,61 @@ FROM ( , subq_7.metric_time__extract_day AS user__metric_time__extract_day , subq_7.metric_time__extract_dow AS user__metric_time__extract_dow , subq_7.metric_time__extract_doy AS user__metric_time__extract_doy + , subq_4.ds__day AS ds__day + , subq_4.ds__week AS ds__week + , subq_4.ds__month AS ds__month + , subq_4.ds__quarter AS ds__quarter + , subq_4.ds__year AS ds__year + , subq_4.ds__extract_year AS ds__extract_year + , subq_4.ds__extract_quarter AS ds__extract_quarter + , subq_4.ds__extract_month AS ds__extract_month + , subq_4.ds__extract_day AS ds__extract_day + , subq_4.ds__extract_dow AS ds__extract_dow + , subq_4.ds__extract_doy AS ds__extract_doy + , subq_4.created_at__day AS created_at__day + , subq_4.created_at__week AS created_at__week + , subq_4.created_at__month AS created_at__month + , subq_4.created_at__quarter AS created_at__quarter + , subq_4.created_at__year AS created_at__year + , subq_4.created_at__extract_year AS created_at__extract_year + , subq_4.created_at__extract_quarter AS created_at__extract_quarter + , subq_4.created_at__extract_month AS created_at__extract_month + , subq_4.created_at__extract_day AS created_at__extract_day + , subq_4.created_at__extract_dow AS created_at__extract_dow + , subq_4.created_at__extract_doy AS created_at__extract_doy + , subq_4.listing__ds__day AS listing__ds__day + , subq_4.listing__ds__week AS listing__ds__week + , subq_4.listing__ds__month AS listing__ds__month + , subq_4.listing__ds__quarter AS listing__ds__quarter + , subq_4.listing__ds__year AS listing__ds__year + , subq_4.listing__ds__extract_year AS listing__ds__extract_year + , subq_4.listing__ds__extract_quarter AS listing__ds__extract_quarter + , subq_4.listing__ds__extract_month AS listing__ds__extract_month + , subq_4.listing__ds__extract_day AS listing__ds__extract_day + , subq_4.listing__ds__extract_dow AS listing__ds__extract_dow + , subq_4.listing__ds__extract_doy AS listing__ds__extract_doy + , subq_4.listing__created_at__day AS listing__created_at__day + , subq_4.listing__created_at__week AS listing__created_at__week + , subq_4.listing__created_at__month AS listing__created_at__month + , subq_4.listing__created_at__quarter AS listing__created_at__quarter + , subq_4.listing__created_at__year AS listing__created_at__year + , subq_4.listing__created_at__extract_year AS listing__created_at__extract_year + , subq_4.listing__created_at__extract_quarter AS listing__created_at__extract_quarter + , subq_4.listing__created_at__extract_month AS listing__created_at__extract_month + , subq_4.listing__created_at__extract_day AS listing__created_at__extract_day + , subq_4.listing__created_at__extract_dow AS listing__created_at__extract_dow + , subq_4.listing__created_at__extract_doy AS listing__created_at__extract_doy + , subq_4.metric_time__day AS metric_time__day + , subq_4.metric_time__week AS metric_time__week + , subq_4.metric_time__month AS metric_time__month + , subq_4.metric_time__quarter AS metric_time__quarter + , subq_4.metric_time__year AS metric_time__year + , subq_4.metric_time__extract_year AS metric_time__extract_year + , subq_4.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_4.metric_time__extract_month AS metric_time__extract_month + , subq_4.metric_time__extract_day AS metric_time__extract_day + , subq_4.metric_time__extract_dow AS metric_time__extract_dow + , subq_4.metric_time__extract_doy AS metric_time__extract_doy , subq_4.listing AS listing , subq_4.user AS user , subq_4.listing__user AS listing__user @@ -393,7 +394,6 @@ FROM ( , subq_4.listing__country_latest AS listing__country_latest , subq_4.listing__is_lux_latest AS listing__is_lux_latest , subq_4.listing__capacity_latest AS listing__capacity_latest - , subq_7.home_state AS user__home_state , subq_4.listings AS listings , subq_4.largest_listing AS largest_listing , subq_4.smallest_listing AS smallest_listing diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_distinct_values_query_with_metric_filter__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_distinct_values_query_with_metric_filter__plan0.sql index 799e437abe..d89cbe19cb 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_distinct_values_query_with_metric_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_distinct_values_query_with_metric_filter__plan0.sql @@ -11,10 +11,10 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_0.listing AS listing + subq_6.listing__bookings AS listing__bookings + , subq_0.listing AS listing , subq_0.lux_listing AS lux_listing , subq_0.listing__lux_listing AS listing__lux_listing - , subq_6.listing__bookings AS listing__bookings FROM ( -- Read Elements From Semantic Model 'lux_listing_mapping' SELECT diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_distinct_values_query_with_metric_filter__plan0_optimized.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_distinct_values_query_with_metric_filter__plan0_optimized.sql index d79ef0aa09..c51da11fab 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_distinct_values_query_with_metric_filter__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_distinct_values_query_with_metric_filter__plan0_optimized.sql @@ -5,8 +5,8 @@ SELECT FROM ( -- Join Standard Outputs SELECT - lux_listing_mapping_src_28000.listing_id AS listing - , subq_15.listing__bookings AS listing__bookings + subq_15.listing__bookings AS listing__bookings + , lux_listing_mapping_src_28000.listing_id AS listing FROM ***************************.dim_lux_listing_id_mapping lux_listing_mapping_src_28000 FULL OUTER JOIN ( -- Aggregate Measures diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_filter_by_metric_in_same_semantic_model_as_queried_metric__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_filter_by_metric_in_same_semantic_model_as_queried_metric__plan0.sql index e5dc490b67..a0a48965f4 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_filter_by_metric_in_same_semantic_model_as_queried_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_filter_by_metric_in_same_semantic_model_as_queried_metric__plan0.sql @@ -22,8 +22,8 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.guest AS guest - , subq_8.guest__booking_value AS guest__booking_value + subq_8.guest__booking_value AS guest__booking_value + , subq_2.guest AS guest , subq_2.bookers AS bookers FROM ( -- Pass Only Elements: ['bookers', 'guest'] diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_filter_with_conversion_metric__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_filter_with_conversion_metric__plan0.sql index 648d83f1db..88183f840e 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_filter_with_conversion_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_filter_with_conversion_metric__plan0.sql @@ -22,8 +22,8 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.user AS user - , subq_19.user__visit_buy_conversion_rate AS user__visit_buy_conversion_rate + subq_19.user__visit_buy_conversion_rate AS user__visit_buy_conversion_rate + , subq_2.user AS user , subq_2.listings AS listings FROM ( -- Pass Only Elements: ['listings', 'user'] diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_group_by_has_local_entity_prefix__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_group_by_has_local_entity_prefix__plan0.sql index 1b6946e2c8..646daaaf6e 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_group_by_has_local_entity_prefix__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_group_by_has_local_entity_prefix__plan0.sql @@ -22,9 +22,9 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.user AS user - , subq_13.listing__user AS user__listing__user + subq_13.listing__user AS user__listing__user , subq_13.listing__user__average_booking_value AS user__listing__user__average_booking_value + , subq_2.user AS user , subq_2.listings AS listings FROM ( -- Pass Only Elements: ['listings', 'user'] @@ -187,8 +187,8 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_5.listing AS listing - , subq_8.user AS listing__user + subq_8.user AS listing__user + , subq_5.listing AS listing , subq_5.average_booking_value AS average_booking_value FROM ( -- Pass Only Elements: ['average_booking_value', 'listing'] 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 index 3146c0bc2f..5ce70b6587 100644 --- 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 @@ -22,9 +22,9 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.customer_third_hop_id AS customer_third_hop_id - , subq_17.account_id__customer_id__customer_third_hop_id AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id + subq_17.account_id__customer_id__customer_third_hop_id AS customer_third_hop_id__account_id__customer_id__customer_third_hop_id , subq_17.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_2.customer_third_hop_id AS customer_third_hop_id , subq_2.third_hop_count AS third_hop_count FROM ( -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id'] @@ -127,10 +127,10 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_5.ds_partitioned__day AS ds_partitioned__day - , subq_12.ds_partitioned__day AS account_id__ds_partitioned__day - , subq_5.account_id AS account_id + subq_12.ds_partitioned__day AS account_id__ds_partitioned__day , subq_12.customer_id__customer_third_hop_id AS account_id__customer_id__customer_third_hop_id + , subq_5.ds_partitioned__day AS ds_partitioned__day + , subq_5.account_id AS account_id , subq_5.txn_count AS txn_count FROM ( -- Pass Only Elements: ['txn_count', 'ds_partitioned__day', 'account_id'] @@ -264,7 +264,44 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_7.ds_partitioned__day AS ds_partitioned__day + subq_10.country AS customer_id__country + , subq_10.customer_third_hop_id__country AS customer_id__customer_third_hop_id__country + , subq_10.acquired_ds__day AS customer_id__acquired_ds__day + , subq_10.acquired_ds__week AS customer_id__acquired_ds__week + , subq_10.acquired_ds__month AS customer_id__acquired_ds__month + , subq_10.acquired_ds__quarter AS customer_id__acquired_ds__quarter + , subq_10.acquired_ds__year AS customer_id__acquired_ds__year + , subq_10.acquired_ds__extract_year AS customer_id__acquired_ds__extract_year + , subq_10.acquired_ds__extract_quarter AS customer_id__acquired_ds__extract_quarter + , subq_10.acquired_ds__extract_month AS customer_id__acquired_ds__extract_month + , subq_10.acquired_ds__extract_day AS customer_id__acquired_ds__extract_day + , subq_10.acquired_ds__extract_dow AS customer_id__acquired_ds__extract_dow + , subq_10.acquired_ds__extract_doy AS customer_id__acquired_ds__extract_doy + , subq_10.customer_third_hop_id__acquired_ds__day AS customer_id__customer_third_hop_id__acquired_ds__day + , subq_10.customer_third_hop_id__acquired_ds__week AS customer_id__customer_third_hop_id__acquired_ds__week + , subq_10.customer_third_hop_id__acquired_ds__month AS customer_id__customer_third_hop_id__acquired_ds__month + , subq_10.customer_third_hop_id__acquired_ds__quarter AS customer_id__customer_third_hop_id__acquired_ds__quarter + , subq_10.customer_third_hop_id__acquired_ds__year AS customer_id__customer_third_hop_id__acquired_ds__year + , subq_10.customer_third_hop_id__acquired_ds__extract_year AS customer_id__customer_third_hop_id__acquired_ds__extract_year + , subq_10.customer_third_hop_id__acquired_ds__extract_quarter AS customer_id__customer_third_hop_id__acquired_ds__extract_quarter + , subq_10.customer_third_hop_id__acquired_ds__extract_month AS customer_id__customer_third_hop_id__acquired_ds__extract_month + , subq_10.customer_third_hop_id__acquired_ds__extract_day AS customer_id__customer_third_hop_id__acquired_ds__extract_day + , subq_10.customer_third_hop_id__acquired_ds__extract_dow AS customer_id__customer_third_hop_id__acquired_ds__extract_dow + , subq_10.customer_third_hop_id__acquired_ds__extract_doy AS customer_id__customer_third_hop_id__acquired_ds__extract_doy + , subq_10.metric_time__day AS customer_id__metric_time__day + , subq_10.metric_time__week AS customer_id__metric_time__week + , subq_10.metric_time__month AS customer_id__metric_time__month + , subq_10.metric_time__quarter AS customer_id__metric_time__quarter + , subq_10.metric_time__year AS customer_id__metric_time__year + , subq_10.metric_time__extract_year AS customer_id__metric_time__extract_year + , subq_10.metric_time__extract_quarter AS customer_id__metric_time__extract_quarter + , subq_10.metric_time__extract_month AS customer_id__metric_time__extract_month + , subq_10.metric_time__extract_day AS customer_id__metric_time__extract_day + , subq_10.metric_time__extract_dow AS customer_id__metric_time__extract_dow + , subq_10.metric_time__extract_doy AS customer_id__metric_time__extract_doy + , subq_10.customer_third_hop_id AS customer_id__customer_third_hop_id + , subq_10.customer_third_hop_id__customer_id AS customer_id__customer_third_hop_id__customer_id + , subq_7.ds_partitioned__day AS ds_partitioned__day , subq_7.ds_partitioned__week AS ds_partitioned__week , subq_7.ds_partitioned__month AS ds_partitioned__month , subq_7.ds_partitioned__quarter AS ds_partitioned__quarter @@ -308,51 +345,14 @@ FROM ( , subq_7.metric_time__extract_day AS metric_time__extract_day , subq_7.metric_time__extract_dow AS metric_time__extract_dow , subq_7.metric_time__extract_doy AS metric_time__extract_doy - , subq_10.acquired_ds__day AS customer_id__acquired_ds__day - , subq_10.acquired_ds__week AS customer_id__acquired_ds__week - , subq_10.acquired_ds__month AS customer_id__acquired_ds__month - , subq_10.acquired_ds__quarter AS customer_id__acquired_ds__quarter - , subq_10.acquired_ds__year AS customer_id__acquired_ds__year - , subq_10.acquired_ds__extract_year AS customer_id__acquired_ds__extract_year - , subq_10.acquired_ds__extract_quarter AS customer_id__acquired_ds__extract_quarter - , subq_10.acquired_ds__extract_month AS customer_id__acquired_ds__extract_month - , subq_10.acquired_ds__extract_day AS customer_id__acquired_ds__extract_day - , subq_10.acquired_ds__extract_dow AS customer_id__acquired_ds__extract_dow - , subq_10.acquired_ds__extract_doy AS customer_id__acquired_ds__extract_doy - , subq_10.customer_third_hop_id__acquired_ds__day AS customer_id__customer_third_hop_id__acquired_ds__day - , subq_10.customer_third_hop_id__acquired_ds__week AS customer_id__customer_third_hop_id__acquired_ds__week - , subq_10.customer_third_hop_id__acquired_ds__month AS customer_id__customer_third_hop_id__acquired_ds__month - , subq_10.customer_third_hop_id__acquired_ds__quarter AS customer_id__customer_third_hop_id__acquired_ds__quarter - , subq_10.customer_third_hop_id__acquired_ds__year AS customer_id__customer_third_hop_id__acquired_ds__year - , subq_10.customer_third_hop_id__acquired_ds__extract_year AS customer_id__customer_third_hop_id__acquired_ds__extract_year - , subq_10.customer_third_hop_id__acquired_ds__extract_quarter AS customer_id__customer_third_hop_id__acquired_ds__extract_quarter - , subq_10.customer_third_hop_id__acquired_ds__extract_month AS customer_id__customer_third_hop_id__acquired_ds__extract_month - , subq_10.customer_third_hop_id__acquired_ds__extract_day AS customer_id__customer_third_hop_id__acquired_ds__extract_day - , subq_10.customer_third_hop_id__acquired_ds__extract_dow AS customer_id__customer_third_hop_id__acquired_ds__extract_dow - , subq_10.customer_third_hop_id__acquired_ds__extract_doy AS customer_id__customer_third_hop_id__acquired_ds__extract_doy - , subq_10.metric_time__day AS customer_id__metric_time__day - , subq_10.metric_time__week AS customer_id__metric_time__week - , subq_10.metric_time__month AS customer_id__metric_time__month - , subq_10.metric_time__quarter AS customer_id__metric_time__quarter - , subq_10.metric_time__year AS customer_id__metric_time__year - , subq_10.metric_time__extract_year AS customer_id__metric_time__extract_year - , subq_10.metric_time__extract_quarter AS customer_id__metric_time__extract_quarter - , subq_10.metric_time__extract_month AS customer_id__metric_time__extract_month - , subq_10.metric_time__extract_day AS customer_id__metric_time__extract_day - , subq_10.metric_time__extract_dow AS customer_id__metric_time__extract_dow - , subq_10.metric_time__extract_doy AS customer_id__metric_time__extract_doy , subq_7.account_id AS account_id , subq_7.customer_id AS customer_id , subq_7.account_id__customer_id AS account_id__customer_id , subq_7.bridge_account__account_id AS bridge_account__account_id , subq_7.bridge_account__customer_id AS bridge_account__customer_id - , subq_10.customer_third_hop_id AS customer_id__customer_third_hop_id - , subq_10.customer_third_hop_id__customer_id AS customer_id__customer_third_hop_id__customer_id , subq_7.extra_dim AS extra_dim , subq_7.account_id__extra_dim AS account_id__extra_dim , subq_7.bridge_account__extra_dim AS bridge_account__extra_dim - , subq_10.country AS customer_id__country - , subq_10.customer_third_hop_id__country AS customer_id__customer_third_hop_id__country , subq_7.account_customer_combos AS account_customer_combos FROM ( -- Metric Time Dimension 'ds_partitioned' 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 index aa1fbcf12d..a57e5675da 100644 --- 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 @@ -22,9 +22,9 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.customer_third_hop_id AS customer_third_hop_id - , subq_10.customer_id__customer_third_hop_id AS customer_third_hop_id__customer_id__customer_third_hop_id + subq_10.customer_id__customer_third_hop_id AS customer_third_hop_id__customer_id__customer_third_hop_id , subq_10.customer_id__customer_third_hop_id__paraguayan_customers AS customer_third_hop_id__customer_id__customer_third_hop_id__paraguayan_customers + , subq_2.customer_third_hop_id AS customer_third_hop_id , subq_2.third_hop_count AS third_hop_count FROM ( -- Pass Only Elements: ['third_hop_count', 'customer_third_hop_id'] diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_metric_filtered_by_itself__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_metric_filtered_by_itself__plan0.sql index c22561e2a0..b10efd3e3b 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_metric_filtered_by_itself__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_metric_filtered_by_itself__plan0.sql @@ -22,8 +22,8 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.listing AS listing - , subq_8.listing__bookers AS listing__bookers + subq_8.listing__bookers AS listing__bookers + , subq_2.listing AS listing , subq_2.bookers AS bookers FROM ( -- Pass Only Elements: ['bookers', 'listing'] diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_metric_with_metric_in_where_filter__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_metric_with_metric_in_where_filter__plan0.sql index 35bfbe44c8..3e41750e11 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_metric_with_metric_in_where_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_metric_with_metric_in_where_filter__plan0.sql @@ -27,9 +27,9 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.metric_time__day AS metric_time__day + subq_8.listing__bookings AS listing__bookings + , subq_2.metric_time__day AS metric_time__day , subq_2.listing AS listing - , subq_8.listing__bookings AS listing__bookings , subq_2.listings AS listings FROM ( -- Pass Only Elements: ['listings', 'metric_time__day', 'listing'] diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_query_with_cumulative_metric_in_where_filter__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_query_with_cumulative_metric_in_where_filter__plan0.sql index 5e05e63f8a..d7686e6bf8 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_query_with_cumulative_metric_in_where_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_query_with_cumulative_metric_in_where_filter__plan0.sql @@ -22,8 +22,8 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.user AS user - , subq_8.user__revenue_all_time AS user__revenue_all_time + subq_8.user__revenue_all_time AS user__revenue_all_time + , subq_2.user AS user , subq_2.listings AS listings FROM ( -- Pass Only Elements: ['listings', 'user'] diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_query_with_derived_metric_in_where_filter__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_query_with_derived_metric_in_where_filter__plan0.sql index b4b77786c8..cfac984d0b 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_query_with_derived_metric_in_where_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_query_with_derived_metric_in_where_filter__plan0.sql @@ -22,8 +22,8 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.listing AS listing - , subq_15.listing__views_times_booking_value AS listing__views_times_booking_value + subq_15.listing__views_times_booking_value AS listing__views_times_booking_value + , subq_2.listing AS listing , subq_2.listings AS listings FROM ( -- Pass Only Elements: ['listings', 'listing'] diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_query_with_multiple_metrics_in_filter__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_query_with_multiple_metrics_in_filter__plan0.sql index 076b390821..7df39950a3 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_query_with_multiple_metrics_in_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_query_with_multiple_metrics_in_filter__plan0.sql @@ -24,9 +24,9 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.listing AS listing - , subq_8.listing__bookings AS listing__bookings + subq_8.listing__bookings AS listing__bookings , subq_14.listing__bookers AS listing__bookers + , subq_2.listing AS listing , subq_2.listings AS listings FROM ( -- Pass Only Elements: ['listings', 'listing', 'listing'] diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_query_with_ratio_metric_in_where_filter__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_query_with_ratio_metric_in_where_filter__plan0.sql index 6d407fb8ca..225b6d2a32 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_query_with_ratio_metric_in_where_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_query_with_ratio_metric_in_where_filter__plan0.sql @@ -22,8 +22,8 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.listing AS listing - , subq_15.listing__bookings_per_booker AS listing__bookings_per_booker + subq_15.listing__bookings_per_booker AS listing__bookings_per_booker + , subq_2.listing AS listing , subq_2.listings AS listings FROM ( -- Pass Only Elements: ['listings', 'listing'] diff --git a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_query_with_simple_metric_in_where_filter__plan0.sql b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_query_with_simple_metric_in_where_filter__plan0.sql index d42f3e3875..97ec04b930 100644 --- a/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_query_with_simple_metric_in_where_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_filter_rendering.py/SqlQueryPlan/DuckDB/test_query_with_simple_metric_in_where_filter__plan0.sql @@ -22,8 +22,8 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.listing AS listing - , subq_8.listing__bookings AS listing__bookings + subq_8.listing__bookings AS listing__bookings + , subq_2.listing AS listing , subq_2.listings AS listings FROM ( -- Pass Only Elements: ['listings', 'listing'] diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_dimensions_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_dimensions_with_time_constraint__plan0.sql index 924b094be0..a38763a78d 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_dimensions_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_dimensions_with_time_constraint__plan0.sql @@ -67,7 +67,8 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_0.ds__day AS ds__day + subq_5.home_state_latest AS user__home_state_latest + , subq_0.ds__day AS ds__day , subq_0.ds__week AS ds__week , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter @@ -121,7 +122,6 @@ FROM ( , subq_0.listing__country_latest AS listing__country_latest , subq_0.listing__is_lux_latest AS listing__is_lux_latest , subq_0.listing__capacity_latest AS listing__capacity_latest - , subq_5.home_state_latest AS user__home_state_latest , subq_0.listings AS listings , subq_0.largest_listing AS largest_listing , subq_0.smallest_listing AS smallest_listing diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_with_other_dimensions__plan0.sql b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_with_other_dimensions__plan0.sql index 9997adfc98..95837e5a9e 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_with_other_dimensions__plan0.sql +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/DuckDB/test_metric_time_with_other_dimensions__plan0.sql @@ -6,7 +6,8 @@ SELECT FROM ( -- Join Standard Outputs SELECT - subq_0.ds__day AS ds__day + subq_5.home_state_latest AS user__home_state_latest + , subq_0.ds__day AS ds__day , subq_0.ds__week AS ds__week , subq_0.ds__month AS ds__month , subq_0.ds__quarter AS ds__quarter @@ -60,7 +61,6 @@ FROM ( , subq_0.listing__country_latest AS listing__country_latest , subq_0.listing__is_lux_latest AS listing__is_lux_latest , subq_0.listing__capacity_latest AS listing__capacity_latest - , subq_5.home_state_latest AS user__home_state_latest , subq_0.listings AS listings , subq_0.largest_listing AS largest_listing , subq_0.smallest_listing AS smallest_listing diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_dimensions_with_time_constraint__plan0.xml b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_dimensions_with_time_constraint__plan0.xml index 59f8d1b5ec..c969ff9725 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_dimensions_with_time_constraint__plan0.xml +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_dimensions_with_time_constraint__plan0.xml @@ -214,208 +214,208 @@ - - - - - - - - - + - + + + + + + + + + + + + + + - - - - + + - + - + - - - - - - + + + + + + + + - + - - - - - - - + + - + - + - + - + - + - - - - - + - - + + + + + + - + - - - + - - + + + + - + - + - + - + - + - + - + - + - + - + + + + + + - + - + - + - + - - - - - - + - + - - - - - - - - - - - - - + - - + + + + + + + + + + + + + + - + - + - - + + - + - + - + diff --git a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_with_other_dimensions__plan0.xml b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_with_other_dimensions__plan0.xml index aa697614b3..356fbd4c20 100644 --- a/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_with_other_dimensions__plan0.xml +++ b/tests_metricflow/snapshots/test_metric_time_without_metrics.py/SqlQueryPlan/test_metric_time_with_other_dimensions__plan0.xml @@ -20,193 +20,193 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - - - - + + + + + + + + + + + - + - + - + - + - + - - - - - - - - - - - + - - + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + + + + + + - + - + - + - + - - - - - - + - + - - - - - - - - - - - + - - + + + + + + + + + + + + - + - + - - + + - + - + - + diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_query_filters__plan0.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_query_filters__plan0.sql index 2337d364dc..5c8a4f3eb1 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_query_filters__plan0.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_query_filters__plan0.sql @@ -39,10 +39,10 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.metric_time__day AS metric_time__day + subq_4.home_state_latest AS user__home_state_latest + , subq_2.metric_time__day AS metric_time__day , subq_2.user AS user , subq_2.visit__referrer_id AS visit__referrer_id - , subq_4.home_state_latest AS user__home_state_latest , subq_2.visits AS visits FROM ( -- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day', 'user'] @@ -301,7 +301,8 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_11.ds__day AS ds__day + subq_13.home_state_latest AS user__home_state_latest + , subq_11.ds__day AS ds__day , subq_11.ds__week AS ds__week , subq_11.ds__month AS ds__month , subq_11.ds__quarter AS ds__quarter @@ -340,7 +341,6 @@ FROM ( , subq_11.visit__session AS visit__session , subq_11.referrer_id AS referrer_id , subq_11.visit__referrer_id AS visit__referrer_id - , subq_13.home_state_latest AS user__home_state_latest , subq_11.visits AS visits , subq_11.visitors AS visitors FROM ( diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_query_filters__plan0_optimized.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_query_filters__plan0_optimized.sql index 4af834567c..0cfc5f2966 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_query_filters__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_conversion_metric_query_filters__plan0_optimized.sql @@ -112,10 +112,10 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_36.metric_time__day AS metric_time__day + users_latest_src_28000.home_state_latest AS user__home_state_latest + , subq_36.metric_time__day AS metric_time__day , subq_36.user AS user , subq_36.visit__referrer_id AS visit__referrer_id - , users_latest_src_28000.home_state_latest AS user__home_state_latest , subq_36.visits AS visits FROM ( -- Read Elements From Semantic Model 'visits_source' diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_query_time_filters__plan0.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_query_time_filters__plan0.sql index 48a9f31b84..6f79ec6c8c 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_query_time_filters__plan0.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_query_time_filters__plan0.sql @@ -32,10 +32,10 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_5.metric_time__day AS metric_time__day + subq_8.country_latest AS listing__country_latest + , subq_5.metric_time__day AS metric_time__day , subq_5.listing AS listing , subq_5.booking__is_instant AS booking__is_instant - , subq_8.country_latest AS listing__country_latest , subq_5.bookers AS bookers FROM ( -- Pass Only Elements: ['bookers', 'booking__is_instant', 'metric_time__day', 'listing'] diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql index 620302ced3..bff625f5b7 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql @@ -57,10 +57,10 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.metric_time__day AS metric_time__day + subq_5.country_latest AS listing__country_latest + , subq_2.metric_time__day AS metric_time__day , subq_2.listing AS listing , subq_2.booking__is_instant AS booking__is_instant - , subq_5.country_latest AS listing__country_latest , subq_2.bookings AS bookings FROM ( -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] @@ -465,10 +465,10 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_20.metric_time__day AS metric_time__day + subq_23.country_latest AS listing__country_latest + , subq_20.metric_time__day AS metric_time__day , subq_20.listing AS listing , subq_20.booking__is_instant AS booking__is_instant - , subq_23.country_latest AS listing__country_latest , subq_20.bookings AS bookings FROM ( -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_metric_time_filter_with_two_targets__plan0.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_metric_time_filter_with_two_targets__plan0.sql index 4107fcf148..a15d93b916 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_metric_time_filter_with_two_targets__plan0.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_metric_time_filter_with_two_targets__plan0.sql @@ -27,9 +27,9 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.metric_time__day AS metric_time__day + subq_5.country_latest AS listing__country_latest + , subq_2.metric_time__day AS metric_time__day , subq_2.listing AS listing - , subq_5.country_latest AS listing__country_latest , subq_2.bookings AS bookings FROM ( -- Pass Only Elements: ['bookings', 'metric_time__day', 'listing'] diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_multiple_categorical_dimension_pushdown__plan0.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_multiple_categorical_dimension_pushdown__plan0.sql index 70f27e867b..9dd9bdab7c 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_multiple_categorical_dimension_pushdown__plan0.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_multiple_categorical_dimension_pushdown__plan0.sql @@ -29,10 +29,10 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.user AS user + subq_4.home_state_latest AS user__home_state_latest + , subq_2.user AS user , subq_2.listing__is_lux_latest AS listing__is_lux_latest , subq_2.listing__capacity_latest AS listing__capacity_latest - , subq_4.home_state_latest AS user__home_state_latest , subq_2.listings AS listings FROM ( -- Pass Only Elements: ['listings', 'listing__is_lux_latest', 'listing__capacity_latest', 'user'] diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_offset_metric_with_query_time_filters__plan0.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_offset_metric_with_query_time_filters__plan0.sql index 2bbf738849..029b248c52 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_offset_metric_with_query_time_filters__plan0.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_offset_metric_with_query_time_filters__plan0.sql @@ -45,10 +45,10 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.metric_time__day AS metric_time__day + subq_5.country_latest AS listing__country_latest + , subq_2.metric_time__day AS metric_time__day , subq_2.listing AS listing , subq_2.booking__is_instant AS booking__is_instant - , subq_5.country_latest AS listing__country_latest , subq_2.bookings AS bookings FROM ( -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] @@ -438,10 +438,10 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_17.metric_time__day AS metric_time__day + subq_20.country_latest AS listing__country_latest + , subq_17.metric_time__day AS metric_time__day , subq_17.listing AS listing , subq_17.booking__is_instant AS booking__is_instant - , subq_20.country_latest AS listing__country_latest , subq_17.bookings AS bookings FROM ( -- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day', 'listing'] diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_saved_query_with_metric_joins_and_filter__plan0.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_saved_query_with_metric_joins_and_filter__plan0.sql index 25af00dd94..3f78f52b66 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_saved_query_with_metric_joins_and_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_saved_query_with_metric_joins_and_filter__plan0.sql @@ -36,10 +36,10 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.metric_time__day AS metric_time__day - , subq_2.listing AS listing - , subq_5.is_lux_latest AS listing__is_lux_latest + subq_5.is_lux_latest AS listing__is_lux_latest , subq_5.capacity_latest AS listing__capacity_latest + , subq_2.metric_time__day AS metric_time__day + , subq_2.listing AS listing , subq_2.bookings AS bookings FROM ( -- Pass Only Elements: ['bookings', 'metric_time__day', 'listing'] @@ -425,10 +425,10 @@ FULL OUTER JOIN ( FROM ( -- Join Standard Outputs SELECT - subq_14.metric_time__day AS metric_time__day - , subq_14.listing AS listing - , subq_17.is_lux_latest AS listing__is_lux_latest + subq_17.is_lux_latest AS listing__is_lux_latest , subq_17.capacity_latest AS listing__capacity_latest + , subq_14.metric_time__day AS metric_time__day + , subq_14.listing AS listing , subq_14.views AS views FROM ( -- Pass Only Elements: ['views', 'metric_time__day', 'listing'] @@ -750,10 +750,10 @@ FULL OUTER JOIN ( FROM ( -- Join Standard Outputs SELECT - subq_26.metric_time__day AS metric_time__day - , subq_26.listing AS listing - , subq_29.is_lux_latest AS listing__is_lux_latest + subq_29.is_lux_latest AS listing__is_lux_latest , subq_29.capacity_latest AS listing__capacity_latest + , subq_26.metric_time__day AS metric_time__day + , subq_26.listing AS listing , subq_26.bookings AS bookings FROM ( -- Pass Only Elements: ['bookings', 'metric_time__day', 'listing'] @@ -1139,10 +1139,10 @@ FULL OUTER JOIN ( FROM ( -- Join Standard Outputs SELECT - subq_38.metric_time__day AS metric_time__day - , subq_38.listing AS listing - , subq_41.is_lux_latest AS listing__is_lux_latest + subq_41.is_lux_latest AS listing__is_lux_latest , subq_41.capacity_latest AS listing__capacity_latest + , subq_38.metric_time__day AS metric_time__day + , subq_38.listing AS listing , subq_38.views AS views FROM ( -- Pass Only Elements: ['views', 'metric_time__day', 'listing'] diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_single_categorical_dimension_pushdown__plan0.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_single_categorical_dimension_pushdown__plan0.sql index 14aba1afb1..5fc23ef4c0 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_single_categorical_dimension_pushdown__plan0.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_single_categorical_dimension_pushdown__plan0.sql @@ -27,9 +27,9 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.listing AS listing + subq_5.country_latest AS listing__country_latest + , subq_2.listing AS listing , subq_2.booking__is_instant AS booking__is_instant - , subq_5.country_latest AS listing__country_latest , subq_2.bookings AS bookings FROM ( -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing'] diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_skipped_pushdown__plan0.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_skipped_pushdown__plan0.sql index a62b838b8c..8c638d3b5e 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_skipped_pushdown__plan0.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/DuckDB/test_skipped_pushdown__plan0.sql @@ -29,10 +29,10 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.listing AS listing - , subq_2.booking__is_instant AS booking__is_instant - , subq_5.country_latest AS listing__country_latest + subq_5.country_latest AS listing__country_latest , subq_5.is_lux_latest AS listing__is_lux_latest + , subq_2.listing AS listing + , subq_2.booking__is_instant AS booking__is_instant , subq_2.bookings AS bookings FROM ( -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing'] diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_on_join_dim__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_on_join_dim__plan0.sql index b8f95359e6..1305901493 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_on_join_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_on_join_dim__plan0.sql @@ -27,9 +27,9 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.listing AS listing + subq_5.country_latest AS listing__country_latest + , subq_2.listing AS listing , subq_2.booking__is_instant AS booking__is_instant - , subq_5.country_latest AS listing__country_latest , subq_2.bookings AS bookings FROM ( -- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing'] diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_join_to_scd_dimension__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_join_to_scd_dimension__plan0.sql index ee768657d4..388adce3a5 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_join_to_scd_dimension__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_join_to_scd_dimension__plan0.sql @@ -27,11 +27,11 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.metric_time__day AS metric_time__day + subq_4.capacity AS listing__capacity , subq_4.window_start__day AS listing__window_start__day , subq_4.window_end__day AS listing__window_end__day + , subq_2.metric_time__day AS metric_time__day , subq_2.listing AS listing - , subq_4.capacity AS listing__capacity , subq_2.bookings AS bookings FROM ( -- Pass Only Elements: ['bookings', 'metric_time__day', 'listing'] diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint__plan0.sql index 0c1c45d416..d37eadd7ca 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_measure_constraint__plan0.sql @@ -39,9 +39,9 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.metric_time__day AS metric_time__day + subq_5.is_lux_latest AS listing__is_lux_latest + , subq_2.metric_time__day AS metric_time__day , subq_2.listing AS listing - , subq_5.is_lux_latest AS listing__is_lux_latest , subq_2.average_booking_value AS average_booking_value FROM ( -- Pass Only Elements: ['average_booking_value', 'metric_time__day', 'listing'] @@ -424,9 +424,9 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_14.metric_time__day AS metric_time__day + subq_17.is_lux_latest AS listing__is_lux_latest + , subq_14.metric_time__day AS metric_time__day , subq_14.listing AS listing - , subq_17.is_lux_latest AS listing__is_lux_latest , subq_14.bookings AS bookings FROM ( -- Pass Only Elements: ['bookings', 'metric_time__day', 'listing'] diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0.sql index 2db2db0066..23e1270946 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_through_scd_dimension__plan0.sql @@ -18,11 +18,11 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.metric_time__day AS metric_time__day + subq_7.user__home_state_latest AS listing__user__home_state_latest , subq_7.window_start__day AS listing__window_start__day , subq_7.window_end__day AS listing__window_end__day + , subq_2.metric_time__day AS metric_time__day , subq_2.listing AS listing - , subq_7.user__home_state_latest AS listing__user__home_state_latest , subq_2.bookings AS bookings FROM ( -- Pass Only Elements: ['bookings', 'metric_time__day', 'listing'] @@ -224,7 +224,19 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_3.window_start__day AS window_start__day + subq_5.home_state_latest AS user__home_state_latest + , subq_5.ds__day AS user__ds__day + , subq_5.ds__week AS user__ds__week + , subq_5.ds__month AS user__ds__month + , subq_5.ds__quarter AS user__ds__quarter + , subq_5.ds__year AS user__ds__year + , subq_5.ds__extract_year AS user__ds__extract_year + , subq_5.ds__extract_quarter AS user__ds__extract_quarter + , subq_5.ds__extract_month AS user__ds__extract_month + , subq_5.ds__extract_day AS user__ds__extract_day + , subq_5.ds__extract_dow AS user__ds__extract_dow + , subq_5.ds__extract_doy AS user__ds__extract_doy + , subq_3.window_start__day AS window_start__day , subq_3.window_start__week AS window_start__week , subq_3.window_start__month AS window_start__month , subq_3.window_start__quarter AS window_start__quarter @@ -268,17 +280,6 @@ FROM ( , subq_3.listing__window_end__extract_day AS listing__window_end__extract_day , subq_3.listing__window_end__extract_dow AS listing__window_end__extract_dow , subq_3.listing__window_end__extract_doy AS listing__window_end__extract_doy - , subq_5.ds__day AS user__ds__day - , subq_5.ds__week AS user__ds__week - , subq_5.ds__month AS user__ds__month - , subq_5.ds__quarter AS user__ds__quarter - , subq_5.ds__year AS user__ds__year - , subq_5.ds__extract_year AS user__ds__extract_year - , subq_5.ds__extract_quarter AS user__ds__extract_quarter - , subq_5.ds__extract_month AS user__ds__extract_month - , subq_5.ds__extract_day AS user__ds__extract_day - , subq_5.ds__extract_dow AS user__ds__extract_dow - , subq_5.ds__extract_doy AS user__ds__extract_doy , subq_3.listing AS listing , subq_3.user AS user , subq_3.listing__user AS listing__user @@ -288,7 +289,6 @@ FROM ( , subq_3.listing__country AS listing__country , subq_3.listing__is_lux AS listing__is_lux , subq_3.listing__capacity AS listing__capacity - , subq_5.home_state_latest AS user__home_state_latest FROM ( -- Read Elements From Semantic Model 'listings' SELECT diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0.sql index b2dfef8dbc..fd5244631f 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_multi_hop_to_scd_dimension__plan0.sql @@ -18,11 +18,11 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.metric_time__day AS metric_time__day + subq_7.lux_listing__is_confirmed_lux AS listing__lux_listing__is_confirmed_lux , subq_7.lux_listing__window_start__day AS listing__lux_listing__window_start__day , subq_7.lux_listing__window_end__day AS listing__lux_listing__window_end__day + , subq_2.metric_time__day AS metric_time__day , subq_2.listing AS listing - , subq_7.lux_listing__is_confirmed_lux AS listing__lux_listing__is_confirmed_lux , subq_2.bookings AS bookings FROM ( -- Pass Only Elements: ['bookings', 'metric_time__day', 'listing'] @@ -224,7 +224,8 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_5.window_start__day AS lux_listing__window_start__day + subq_5.is_confirmed_lux AS lux_listing__is_confirmed_lux + , subq_5.window_start__day AS lux_listing__window_start__day , subq_5.window_start__week AS lux_listing__window_start__week , subq_5.window_start__month AS lux_listing__window_start__month , subq_5.window_start__quarter AS lux_listing__window_start__quarter @@ -249,7 +250,6 @@ FROM ( , subq_3.listing AS listing , subq_3.lux_listing AS lux_listing , subq_3.listing__lux_listing AS listing__lux_listing - , subq_5.is_confirmed_lux AS lux_listing__is_confirmed_lux FROM ( -- Read Elements From Semantic Model 'lux_listing_mapping' SELECT 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 a2cfac78b0..457fb2d259 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 @@ -15,10 +15,10 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.ds_partitioned__day AS ds_partitioned__day + subq_9.customer_id__customer_name AS account_id__customer_id__customer_name , subq_9.ds_partitioned__day AS account_id__ds_partitioned__day + , subq_2.ds_partitioned__day AS ds_partitioned__day , subq_2.account_id AS account_id - , subq_9.customer_id__customer_name AS account_id__customer_id__customer_name , subq_2.txn_count AS txn_count FROM ( -- Pass Only Elements: ['txn_count', 'ds_partitioned__day', 'account_id'] @@ -152,7 +152,31 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_4.ds_partitioned__day AS ds_partitioned__day + subq_7.customer_name AS customer_id__customer_name + , subq_7.customer_atomic_weight AS customer_id__customer_atomic_weight + , subq_7.ds_partitioned__day AS customer_id__ds_partitioned__day + , subq_7.ds_partitioned__week AS customer_id__ds_partitioned__week + , subq_7.ds_partitioned__month AS customer_id__ds_partitioned__month + , subq_7.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter + , subq_7.ds_partitioned__year AS customer_id__ds_partitioned__year + , subq_7.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year + , subq_7.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter + , subq_7.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month + , subq_7.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day + , subq_7.ds_partitioned__extract_dow AS customer_id__ds_partitioned__extract_dow + , subq_7.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy + , subq_7.metric_time__day AS customer_id__metric_time__day + , subq_7.metric_time__week AS customer_id__metric_time__week + , subq_7.metric_time__month AS customer_id__metric_time__month + , subq_7.metric_time__quarter AS customer_id__metric_time__quarter + , subq_7.metric_time__year AS customer_id__metric_time__year + , subq_7.metric_time__extract_year AS customer_id__metric_time__extract_year + , subq_7.metric_time__extract_quarter AS customer_id__metric_time__extract_quarter + , subq_7.metric_time__extract_month AS customer_id__metric_time__extract_month + , subq_7.metric_time__extract_day AS customer_id__metric_time__extract_day + , subq_7.metric_time__extract_dow AS customer_id__metric_time__extract_dow + , subq_7.metric_time__extract_doy AS customer_id__metric_time__extract_doy + , subq_4.ds_partitioned__day AS ds_partitioned__day , subq_4.ds_partitioned__week AS ds_partitioned__week , subq_4.ds_partitioned__month AS ds_partitioned__month , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter @@ -196,28 +220,6 @@ FROM ( , subq_4.metric_time__extract_day AS metric_time__extract_day , subq_4.metric_time__extract_dow AS metric_time__extract_dow , subq_4.metric_time__extract_doy AS metric_time__extract_doy - , subq_7.ds_partitioned__day AS customer_id__ds_partitioned__day - , subq_7.ds_partitioned__week AS customer_id__ds_partitioned__week - , subq_7.ds_partitioned__month AS customer_id__ds_partitioned__month - , subq_7.ds_partitioned__quarter AS customer_id__ds_partitioned__quarter - , subq_7.ds_partitioned__year AS customer_id__ds_partitioned__year - , subq_7.ds_partitioned__extract_year AS customer_id__ds_partitioned__extract_year - , subq_7.ds_partitioned__extract_quarter AS customer_id__ds_partitioned__extract_quarter - , subq_7.ds_partitioned__extract_month AS customer_id__ds_partitioned__extract_month - , subq_7.ds_partitioned__extract_day AS customer_id__ds_partitioned__extract_day - , subq_7.ds_partitioned__extract_dow AS customer_id__ds_partitioned__extract_dow - , subq_7.ds_partitioned__extract_doy AS customer_id__ds_partitioned__extract_doy - , subq_7.metric_time__day AS customer_id__metric_time__day - , subq_7.metric_time__week AS customer_id__metric_time__week - , subq_7.metric_time__month AS customer_id__metric_time__month - , subq_7.metric_time__quarter AS customer_id__metric_time__quarter - , subq_7.metric_time__year AS customer_id__metric_time__year - , subq_7.metric_time__extract_year AS customer_id__metric_time__extract_year - , subq_7.metric_time__extract_quarter AS customer_id__metric_time__extract_quarter - , subq_7.metric_time__extract_month AS customer_id__metric_time__extract_month - , subq_7.metric_time__extract_day AS customer_id__metric_time__extract_day - , subq_7.metric_time__extract_dow AS customer_id__metric_time__extract_dow - , subq_7.metric_time__extract_doy AS customer_id__metric_time__extract_doy , subq_4.account_id AS account_id , subq_4.customer_id AS customer_id , subq_4.account_id__customer_id AS account_id__customer_id @@ -226,8 +228,6 @@ FROM ( , subq_4.extra_dim AS extra_dim , subq_4.account_id__extra_dim AS account_id__extra_dim , subq_4.bridge_account__extra_dim AS bridge_account__extra_dim - , subq_7.customer_name AS customer_id__customer_name - , subq_7.customer_atomic_weight AS customer_id__customer_atomic_weight , subq_4.account_customer_combos AS account_customer_combos FROM ( -- Metric Time Dimension 'ds_partitioned' diff --git a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0.sql b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0.sql index 9331570241..c1a2b4b8f9 100644 --- a/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0.sql +++ b/tests_metricflow/snapshots/test_query_rendering.py/SqlQueryPlan/DuckDB/test_partitioned_join__plan0.sql @@ -15,10 +15,10 @@ FROM ( FROM ( -- Join Standard Outputs SELECT - subq_2.ds_partitioned__day AS ds_partitioned__day + subq_5.home_state AS user__home_state , subq_5.ds_partitioned__day AS user__ds_partitioned__day + , subq_2.ds_partitioned__day AS ds_partitioned__day , subq_2.user AS user - , subq_5.home_state AS user__home_state , subq_2.identity_verifications AS identity_verifications FROM ( -- Pass Only Elements: ['identity_verifications', 'ds_partitioned__day', 'user']