diff --git a/.changes/unreleased/Fixes-20241121-073923.yaml b/.changes/unreleased/Fixes-20241121-073923.yaml new file mode 100644 index 000000000..00afb92de --- /dev/null +++ b/.changes/unreleased/Fixes-20241121-073923.yaml @@ -0,0 +1,6 @@ +kind: Fixes +body: Always treat metric_time and the agg_time_dimension the same in the JoinToTimeSpineNode. +time: 2024-11-21T07:39:23.698194-08:00 +custom: + Author: courtneyholcomb + Issue: "1541" diff --git a/metricflow-semantics/metricflow_semantics/instances.py b/metricflow-semantics/metricflow_semantics/instances.py index c6a0f8e2b..bc4e5ae7b 100644 --- a/metricflow-semantics/metricflow_semantics/instances.py +++ b/metricflow-semantics/metricflow_semantics/instances.py @@ -145,6 +145,12 @@ def with_entity_prefix( spec=transformed_spec, ) + def with_new_defined_from(self, defined_from: Sequence[SemanticModelElementReference]) -> TimeDimensionInstance: + """Returns a new instance with the defined_from field replaced.""" + return TimeDimensionInstance( + associated_columns=self.associated_columns, defined_from=tuple(defined_from), spec=self.spec + ) + @dataclass(frozen=True) class EntityInstance(LinkableInstance[EntitySpec], SemanticModelElementInstance): # noqa: D101 diff --git a/metricflow-semantics/metricflow_semantics/specs/time_dimension_spec.py b/metricflow-semantics/metricflow_semantics/specs/time_dimension_spec.py index 5dc90f842..9c9637cf4 100644 --- a/metricflow-semantics/metricflow_semantics/specs/time_dimension_spec.py +++ b/metricflow-semantics/metricflow_semantics/specs/time_dimension_spec.py @@ -244,3 +244,16 @@ def with_entity_prefix(self, entity_prefix: EntityReference) -> TimeDimensionSpe date_part=self.date_part, aggregation_state=self.aggregation_state, ) + + @staticmethod + def with_base_grains(time_dimension_specs: Sequence[TimeDimensionSpec]) -> Sequence[TimeDimensionSpec]: + """Return the list of time dimension specs, replacing any custom grains with base grains. + + Dedupes new specs, but preserves the initial order. + """ + base_grain_specs: List[TimeDimensionSpec] = [] + for spec in time_dimension_specs: + base_grain_spec = spec.with_base_grain() + if base_grain_spec not in base_grain_specs: + base_grain_specs.append(base_grain_spec) + return base_grain_specs diff --git a/metricflow/dataflow/builder/dataflow_plan_builder.py b/metricflow/dataflow/builder/dataflow_plan_builder.py index 6ca9bae1f..46f70cb54 100644 --- a/metricflow/dataflow/builder/dataflow_plan_builder.py +++ b/metricflow/dataflow/builder/dataflow_plan_builder.py @@ -14,7 +14,7 @@ MetricTimeWindow, MetricType, ) -from dbt_semantic_interfaces.references import MetricReference, TimeDimensionReference +from dbt_semantic_interfaces.references import MeasureReference, MetricReference, TimeDimensionReference from dbt_semantic_interfaces.type_enums.time_granularity import TimeGranularity from dbt_semantic_interfaces.validations.unique_valid_name import MetricFlowReservedKeywords from metricflow_semantics.dag.id_prefix import StaticIdPrefix @@ -653,9 +653,6 @@ def _build_derived_metric_output_node( queried_agg_time_dimension_specs = queried_linkable_specs.included_agg_time_dimension_specs_for_metric( metric_reference=metric_spec.reference, metric_lookup=self._metric_lookup ) - assert ( - queried_agg_time_dimension_specs - ), "Joining to time spine requires querying with metric_time or the appropriate agg_time_dimension." output_node = JoinToTimeSpineNode.create( parent_node=output_node, requested_agg_time_dimension_specs=queried_agg_time_dimension_specs, @@ -684,6 +681,19 @@ def _build_derived_metric_output_node( ) return output_node + def _get_base_agg_time_dimensions( + self, queried_linkable_specs: LinkableSpecSet, measure_reference: MeasureReference + ) -> Sequence[TimeDimensionSpec]: + """Get queried agg_time_dimensios with their base grains, deduped. + + Custom grains are joined right before measure aggregation and after all other pre-aggregation joins, + so only base grains are needed prior to that point. + """ + queried_agg_time_dimension_specs = queried_linkable_specs.included_agg_time_dimension_specs_for_measure( + measure_reference=measure_reference, semantic_model_lookup=self._semantic_model_lookup + ) + return TimeDimensionSpec.with_base_grains(queried_agg_time_dimension_specs) + def _build_any_metric_output_node(self, parameter_set: BuildAnyMetricOutputNodeParameterSet) -> DataflowPlanNode: """Builds a node to compute a metric of any type.""" result = self._cache.get_build_any_metric_output_node_result(parameter_set) @@ -1603,17 +1613,17 @@ def _build_aggregated_measure_from_measure_source_node( f"Unable to join all items in request. Measure: {measure_spec.element_name}; Specs to join: {required_linkable_specs}" ) - queried_agg_time_dimension_specs = queried_linkable_specs.included_agg_time_dimension_specs_for_measure( - measure_reference=measure_spec.reference, semantic_model_lookup=self._semantic_model_lookup + base_agg_time_dimension_specs = self._get_base_agg_time_dimensions( + queried_linkable_specs=queried_linkable_specs, measure_reference=measure_spec.reference ) # If a cumulative metric is queried with metric_time / agg_time_dimension, join over time range. # Otherwise, the measure will be aggregated over all time. unaggregated_measure_node: DataflowPlanNode = measure_recipe.source_node - if cumulative and queried_agg_time_dimension_specs: + if cumulative and base_agg_time_dimension_specs: unaggregated_measure_node = JoinOverTimeRangeNode.create( parent_node=unaggregated_measure_node, - queried_agg_time_dimension_specs=tuple(queried_agg_time_dimension_specs), + queried_agg_time_dimension_specs=tuple(base_agg_time_dimension_specs), window=cumulative_window, grain_to_date=cumulative_grain_to_date, # Note: we use the original constraint here because the JoinOverTimeRangeNode will eventually get @@ -1635,7 +1645,7 @@ def _build_aggregated_measure_from_measure_source_node( # in join rendering unaggregated_measure_node = JoinToTimeSpineNode.create( parent_node=unaggregated_measure_node, - requested_agg_time_dimension_specs=queried_agg_time_dimension_specs, + requested_agg_time_dimension_specs=base_agg_time_dimension_specs, use_custom_agg_time_dimension=not queried_linkable_specs.contains_metric_time, time_range_constraint=predicate_pushdown_state.time_range_constraint, offset_window=before_aggregation_time_spine_join_description.offset_window, @@ -1705,6 +1715,9 @@ def _build_aggregated_measure_from_measure_source_node( # TODO: split this node into TimeSpineSourceNode and JoinToTimeSpineNode - then can use standard nodes here # like JoinToCustomGranularityNode, WhereConstraintNode, etc. + queried_agg_time_dimension_specs = queried_linkable_specs.included_agg_time_dimension_specs_for_measure( + measure_reference=measure_spec.reference, semantic_model_lookup=self._semantic_model_lookup + ) output_node: DataflowPlanNode = JoinToTimeSpineNode.create( parent_node=aggregate_measures_node, requested_agg_time_dimension_specs=queried_agg_time_dimension_specs, diff --git a/metricflow/plan_conversion/dataflow_to_sql.py b/metricflow/plan_conversion/dataflow_to_sql.py index 526618a9f..2c6e6bfb6 100644 --- a/metricflow/plan_conversion/dataflow_to_sql.py +++ b/metricflow/plan_conversion/dataflow_to_sql.py @@ -6,9 +6,8 @@ from typing import Callable, Dict, FrozenSet, List, Optional, Sequence, Set, Tuple, TypeVar, Union from dbt_semantic_interfaces.enum_extension import assert_values_exhausted -from dbt_semantic_interfaces.naming.keywords import METRIC_TIME_ELEMENT_NAME from dbt_semantic_interfaces.protocols.metric import MetricInputMeasure, MetricType -from dbt_semantic_interfaces.references import EntityReference, MetricModelReference, SemanticModelElementReference +from dbt_semantic_interfaces.references import MetricModelReference, SemanticModelElementReference from dbt_semantic_interfaces.type_enums.aggregation_type import AggregationType from dbt_semantic_interfaces.type_enums.conversion_calculation_type import ConversionCalculationType from dbt_semantic_interfaces.type_enums.period_agg import PeriodAggregation @@ -471,11 +470,10 @@ def visit_join_over_time_range_node(self, node: JoinOverTimeRangeNode) -> SqlDat parent_data_set = node.parent_node.accept(self) parent_data_set_alias = self._next_unique_table_alias() - # For the purposes of this node, use base grains. Custom grains will be joined later in the dataflow plan. - agg_time_dimension_specs = tuple({spec.with_base_grain() for spec in node.queried_agg_time_dimension_specs}) - # Assemble time_spine dataset with a column for each agg_time_dimension requested. - agg_time_dimension_instances = parent_data_set.instances_for_time_dimensions(agg_time_dimension_specs) + agg_time_dimension_instances = parent_data_set.instances_for_time_dimensions( + node.queried_agg_time_dimension_specs + ) time_spine_data_set_alias = self._next_unique_table_alias() time_spine_data_set = self._make_time_spine_data_set( agg_time_dimension_instances=agg_time_dimension_instances, time_range_constraint=node.time_range_constraint @@ -492,7 +490,7 @@ def visit_join_over_time_range_node(self, node: JoinOverTimeRangeNode) -> SqlDat # Build select columns, replacing agg_time_dimensions from the parent node with columns from the time spine. table_alias_to_instance_set[time_spine_data_set_alias] = time_spine_data_set.instance_set table_alias_to_instance_set[parent_data_set_alias] = parent_data_set.instance_set.transform( - FilterElements(exclude_specs=InstanceSpecSet(time_dimension_specs=agg_time_dimension_specs)) + FilterElements(exclude_specs=InstanceSpecSet(time_dimension_specs=node.queried_agg_time_dimension_specs)) ) select_columns = create_simple_select_columns_for_instance_sets( column_resolver=self._column_association_resolver, table_alias_to_instance_set=table_alias_to_instance_set @@ -1382,33 +1380,30 @@ def visit_join_to_time_spine_node(self, node: JoinToTimeSpineNode) -> SqlDataSet parent_data_set = node.parent_node.accept(self) parent_alias = self._next_unique_table_alias() - if node.use_custom_agg_time_dimension: - agg_time_dimension = node.requested_agg_time_dimension_specs[0] - agg_time_element_name = agg_time_dimension.element_name - agg_time_entity_links: Tuple[EntityReference, ...] = agg_time_dimension.entity_links - else: - agg_time_element_name = METRIC_TIME_ELEMENT_NAME - agg_time_entity_links = () + agg_time_dimension_instances = parent_data_set.instances_for_time_dimensions( + node.requested_agg_time_dimension_specs + ) - # Find the time dimension instances in the parent data set that match the one we want to join with. - agg_time_dimension_instances: List[TimeDimensionInstance] = [] - for instance in parent_data_set.instance_set.time_dimension_instances: - if ( - instance.spec.date_part is None # Ensure we don't join using an instance with date part - and instance.spec.element_name == agg_time_element_name - and instance.spec.entity_links == agg_time_entity_links - ): - agg_time_dimension_instances.append(instance) + # Select the dimension for the join from the parent node because it may not have been included in the request. + # Default to using metric_time for the join if it was requested, otherwise use the agg_time_dimension. + included_metric_time_instances = [ + instance for instance in agg_time_dimension_instances if instance.spec.is_metric_time + ] + if included_metric_time_instances: + join_on_time_dimension_sample = included_metric_time_instances[0].spec + else: + join_on_time_dimension_sample = agg_time_dimension_instances[0].spec - # Choose the instance with the smallest base granularity available. - agg_time_dimension_instances.sort(key=lambda instance: instance.spec.time_granularity.base_granularity.to_int()) - assert len(agg_time_dimension_instances) > 0, ( - "Couldn't find requested agg_time_dimension in parent data set. The dataflow plan may have been " - "configured incorrectly." + agg_time_dimension_instance_for_join = self._choose_instance_for_time_spine_join( + [ + instance + for instance in parent_data_set.instance_set.time_dimension_instances + if instance.spec.element_name == join_on_time_dimension_sample.element_name + and instance.spec.entity_links == join_on_time_dimension_sample.entity_links + ] ) - agg_time_dimension_instance_for_join = agg_time_dimension_instances[0] - # Build time spine data set using the requested agg_time_dimension name. + # Build time spine data set with just the agg_time_dimension instance needed for the join. time_spine_alias = self._next_unique_table_alias() time_spine_dataset = self._make_time_spine_data_set( agg_time_dimension_instances=(agg_time_dimension_instance_for_join,), @@ -1432,24 +1427,14 @@ def visit_join_to_time_spine_node(self, node: JoinToTimeSpineNode) -> SqlDataSet time_dimensions_to_select_from_parent: Tuple[TimeDimensionInstance, ...] = () time_dimensions_to_select_from_time_spine: Tuple[TimeDimensionInstance, ...] = () for time_dimension_instance in parent_data_set.instance_set.time_dimension_instances: - if ( - time_dimension_instance.spec.element_name == agg_time_element_name - and time_dimension_instance.spec.entity_links == agg_time_entity_links - ): + if time_dimension_instance in agg_time_dimension_instances: time_dimensions_to_select_from_time_spine += (time_dimension_instance,) else: time_dimensions_to_select_from_parent += (time_dimension_instance,) parent_instance_set = InstanceSet( measure_instances=parent_data_set.instance_set.measure_instances, dimension_instances=parent_data_set.instance_set.dimension_instances, - time_dimension_instances=tuple( - time_dimension_instance - for time_dimension_instance in parent_data_set.instance_set.time_dimension_instances - if not ( - time_dimension_instance.spec.element_name == agg_time_element_name - and time_dimension_instance.spec.entity_links == agg_time_entity_links - ) - ), + time_dimension_instances=time_dimensions_to_select_from_parent, entity_instances=parent_data_set.instance_set.entity_instances, metric_instances=parent_data_set.instance_set.metric_instances, metadata_instances=parent_data_set.instance_set.metadata_instances, @@ -1481,8 +1466,8 @@ def visit_join_to_time_spine_node(self, node: JoinToTimeSpineNode) -> SqlDataSet ) # Add requested granularities (if different from time_spine) and date_parts to time spine column. - for time_dimension_instance in time_dimensions_to_select_from_time_spine: - time_dimension_spec = time_dimension_instance.spec + for parent_time_dimension_instance in time_dimensions_to_select_from_time_spine: + time_dimension_spec = parent_time_dimension_instance.spec if ( time_dimension_spec.time_granularity.base_granularity.to_int() < original_time_spine_dim_instance.spec.time_granularity.base_granularity.to_int() @@ -1521,13 +1506,9 @@ def visit_join_to_time_spine_node(self, node: JoinToTimeSpineNode) -> SqlDataSet # Apply date_part to time spine column select expression. if time_dimension_spec.date_part: select_expr = SqlExtractExpression.create(date_part=time_dimension_spec.date_part, arg=select_expr) - time_dim_spec = original_time_spine_dim_instance.spec.with_grain_and_date_part( - time_granularity=time_dimension_spec.time_granularity, date_part=time_dimension_spec.date_part - ) - time_spine_dim_instance = TimeDimensionInstance( - defined_from=original_time_spine_dim_instance.defined_from, - associated_columns=(self._column_association_resolver.resolve_spec(time_dim_spec),), - spec=time_dim_spec, + + time_spine_dim_instance = parent_time_dimension_instance.with_new_defined_from( + original_time_spine_dim_instance.defined_from ) time_spine_dim_instances.append(time_spine_dim_instance) time_spine_select_columns.append( diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_window_metric_with_non_default_grains__plan0.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_window_metric_with_non_default_grains__plan0.sql index d8ffb1b0b..983896334 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_window_metric_with_non_default_grains__plan0.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_window_metric_with_non_default_grains__plan0.sql @@ -8,34 +8,34 @@ sql_engine: BigQuery --- -- Re-aggregate Metric via Group By SELECT - subq_11.metric_time__week - , subq_11.booking__ds__month + subq_11.booking__ds__month + , subq_11.metric_time__week , subq_11.every_two_days_bookers_fill_nulls_with_0 FROM ( -- Window Function for Metric Re-aggregation SELECT - subq_10.metric_time__week - , subq_10.booking__ds__month + subq_10.booking__ds__month + , subq_10.metric_time__week , FIRST_VALUE(subq_10.every_two_days_bookers_fill_nulls_with_0) OVER ( PARTITION BY - subq_10.metric_time__week - , subq_10.booking__ds__month + subq_10.booking__ds__month + , subq_10.metric_time__week ORDER BY subq_10.metric_time__day ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS every_two_days_bookers_fill_nulls_with_0 FROM ( -- Compute Metrics via Expressions SELECT - subq_9.metric_time__day + subq_9.booking__ds__month + , subq_9.metric_time__day , subq_9.metric_time__week - , subq_9.booking__ds__month , COALESCE(subq_9.bookers, 0) AS every_two_days_bookers_fill_nulls_with_0 FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day + DATETIME_TRUNC(subq_7.metric_time__day, month) AS booking__ds__month + , subq_7.metric_time__day AS metric_time__day , DATETIME_TRUNC(subq_7.metric_time__day, isoweek) AS metric_time__week - , subq_6.booking__ds__month AS booking__ds__month , subq_6.bookers AS bookers FROM ( -- Time Spine @@ -380,6 +380,6 @@ FROM ( ) subq_10 ) subq_11 GROUP BY - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , every_two_days_bookers_fill_nulls_with_0 diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_window_metric_with_non_default_grains__plan0_optimized.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_window_metric_with_non_default_grains__plan0_optimized.sql index c0ca6dd62..76197cdbc 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_window_metric_with_non_default_grains__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_window_metric_with_non_default_grains__plan0_optimized.sql @@ -8,28 +8,28 @@ sql_engine: BigQuery --- -- Re-aggregate Metric via Group By SELECT - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , every_two_days_bookers_fill_nulls_with_0 FROM ( -- Compute Metrics via Expressions -- Window Function for Metric Re-aggregation SELECT - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , FIRST_VALUE(COALESCE(bookers, 0)) OVER ( PARTITION BY - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week ORDER BY metric_time__day ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS every_two_days_bookers_fill_nulls_with_0 FROM ( -- Join to Time Spine Dataset SELECT - subq_20.ds AS metric_time__day + DATETIME_TRUNC(subq_20.ds, month) AS booking__ds__month + , subq_20.ds AS metric_time__day , DATETIME_TRUNC(subq_20.ds, isoweek) AS metric_time__week - , subq_18.booking__ds__month AS booking__ds__month , subq_18.bookers AS bookers FROM ***************************.mf_time_spine subq_20 LEFT OUTER JOIN ( @@ -60,6 +60,6 @@ FROM ( ) subq_21 ) subq_23 GROUP BY - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , every_two_days_bookers_fill_nulls_with_0 diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_window_metric_with_non_default_grains__plan0.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_window_metric_with_non_default_grains__plan0.sql index a06996713..6c8eaceb9 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_window_metric_with_non_default_grains__plan0.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_window_metric_with_non_default_grains__plan0.sql @@ -8,34 +8,34 @@ sql_engine: Databricks --- -- Re-aggregate Metric via Group By SELECT - subq_11.metric_time__week - , subq_11.booking__ds__month + subq_11.booking__ds__month + , subq_11.metric_time__week , subq_11.every_two_days_bookers_fill_nulls_with_0 FROM ( -- Window Function for Metric Re-aggregation SELECT - subq_10.metric_time__week - , subq_10.booking__ds__month + subq_10.booking__ds__month + , subq_10.metric_time__week , FIRST_VALUE(subq_10.every_two_days_bookers_fill_nulls_with_0) OVER ( PARTITION BY - subq_10.metric_time__week - , subq_10.booking__ds__month + subq_10.booking__ds__month + , subq_10.metric_time__week ORDER BY subq_10.metric_time__day ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS every_two_days_bookers_fill_nulls_with_0 FROM ( -- Compute Metrics via Expressions SELECT - subq_9.metric_time__day + subq_9.booking__ds__month + , subq_9.metric_time__day , subq_9.metric_time__week - , subq_9.booking__ds__month , COALESCE(subq_9.bookers, 0) AS every_two_days_bookers_fill_nulls_with_0 FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day + DATE_TRUNC('month', subq_7.metric_time__day) AS booking__ds__month + , subq_7.metric_time__day AS metric_time__day , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , subq_6.booking__ds__month AS booking__ds__month , subq_6.bookers AS bookers FROM ( -- Time Spine @@ -380,6 +380,6 @@ FROM ( ) subq_10 ) subq_11 GROUP BY - subq_11.metric_time__week - , subq_11.booking__ds__month + subq_11.booking__ds__month + , subq_11.metric_time__week , subq_11.every_two_days_bookers_fill_nulls_with_0 diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_window_metric_with_non_default_grains__plan0_optimized.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_window_metric_with_non_default_grains__plan0_optimized.sql index 8781e118b..4a16253b6 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_window_metric_with_non_default_grains__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_window_metric_with_non_default_grains__plan0_optimized.sql @@ -8,28 +8,28 @@ sql_engine: Databricks --- -- Re-aggregate Metric via Group By SELECT - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , every_two_days_bookers_fill_nulls_with_0 FROM ( -- Compute Metrics via Expressions -- Window Function for Metric Re-aggregation SELECT - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , FIRST_VALUE(COALESCE(bookers, 0)) OVER ( PARTITION BY - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week ORDER BY metric_time__day ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS every_two_days_bookers_fill_nulls_with_0 FROM ( -- Join to Time Spine Dataset SELECT - subq_20.ds AS metric_time__day + DATE_TRUNC('month', subq_20.ds) AS booking__ds__month + , subq_20.ds AS metric_time__day , DATE_TRUNC('week', subq_20.ds) AS metric_time__week - , subq_18.booking__ds__month AS booking__ds__month , subq_18.bookers AS bookers FROM ***************************.mf_time_spine subq_20 LEFT OUTER JOIN ( @@ -60,6 +60,6 @@ FROM ( ) subq_21 ) subq_23 GROUP BY - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , every_two_days_bookers_fill_nulls_with_0 diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_window_metric_with_non_default_grains__plan0.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_window_metric_with_non_default_grains__plan0.sql index 59e5ddc36..537eeb865 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_window_metric_with_non_default_grains__plan0.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_window_metric_with_non_default_grains__plan0.sql @@ -8,34 +8,34 @@ sql_engine: DuckDB --- -- Re-aggregate Metric via Group By SELECT - subq_11.metric_time__week - , subq_11.booking__ds__month + subq_11.booking__ds__month + , subq_11.metric_time__week , subq_11.every_two_days_bookers_fill_nulls_with_0 FROM ( -- Window Function for Metric Re-aggregation SELECT - subq_10.metric_time__week - , subq_10.booking__ds__month + subq_10.booking__ds__month + , subq_10.metric_time__week , FIRST_VALUE(subq_10.every_two_days_bookers_fill_nulls_with_0) OVER ( PARTITION BY - subq_10.metric_time__week - , subq_10.booking__ds__month + subq_10.booking__ds__month + , subq_10.metric_time__week ORDER BY subq_10.metric_time__day ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS every_two_days_bookers_fill_nulls_with_0 FROM ( -- Compute Metrics via Expressions SELECT - subq_9.metric_time__day + subq_9.booking__ds__month + , subq_9.metric_time__day , subq_9.metric_time__week - , subq_9.booking__ds__month , COALESCE(subq_9.bookers, 0) AS every_two_days_bookers_fill_nulls_with_0 FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day + DATE_TRUNC('month', subq_7.metric_time__day) AS booking__ds__month + , subq_7.metric_time__day AS metric_time__day , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , subq_6.booking__ds__month AS booking__ds__month , subq_6.bookers AS bookers FROM ( -- Time Spine @@ -380,6 +380,6 @@ FROM ( ) subq_10 ) subq_11 GROUP BY - subq_11.metric_time__week - , subq_11.booking__ds__month + subq_11.booking__ds__month + , subq_11.metric_time__week , subq_11.every_two_days_bookers_fill_nulls_with_0 diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_window_metric_with_non_default_grains__plan0_optimized.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_window_metric_with_non_default_grains__plan0_optimized.sql index bcfdbe9aa..3e431cfda 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_window_metric_with_non_default_grains__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_window_metric_with_non_default_grains__plan0_optimized.sql @@ -8,28 +8,28 @@ sql_engine: DuckDB --- -- Re-aggregate Metric via Group By SELECT - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , every_two_days_bookers_fill_nulls_with_0 FROM ( -- Compute Metrics via Expressions -- Window Function for Metric Re-aggregation SELECT - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , FIRST_VALUE(COALESCE(bookers, 0)) OVER ( PARTITION BY - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week ORDER BY metric_time__day ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS every_two_days_bookers_fill_nulls_with_0 FROM ( -- Join to Time Spine Dataset SELECT - subq_20.ds AS metric_time__day + DATE_TRUNC('month', subq_20.ds) AS booking__ds__month + , subq_20.ds AS metric_time__day , DATE_TRUNC('week', subq_20.ds) AS metric_time__week - , subq_18.booking__ds__month AS booking__ds__month , subq_18.bookers AS bookers FROM ***************************.mf_time_spine subq_20 LEFT OUTER JOIN ( @@ -60,6 +60,6 @@ FROM ( ) subq_21 ) subq_23 GROUP BY - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , every_two_days_bookers_fill_nulls_with_0 diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_window_metric_with_non_default_grains__plan0.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_window_metric_with_non_default_grains__plan0.sql index 440e5837e..e1cf8da44 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_window_metric_with_non_default_grains__plan0.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_window_metric_with_non_default_grains__plan0.sql @@ -8,34 +8,34 @@ sql_engine: Postgres --- -- Re-aggregate Metric via Group By SELECT - subq_11.metric_time__week - , subq_11.booking__ds__month + subq_11.booking__ds__month + , subq_11.metric_time__week , subq_11.every_two_days_bookers_fill_nulls_with_0 FROM ( -- Window Function for Metric Re-aggregation SELECT - subq_10.metric_time__week - , subq_10.booking__ds__month + subq_10.booking__ds__month + , subq_10.metric_time__week , FIRST_VALUE(subq_10.every_two_days_bookers_fill_nulls_with_0) OVER ( PARTITION BY - subq_10.metric_time__week - , subq_10.booking__ds__month + subq_10.booking__ds__month + , subq_10.metric_time__week ORDER BY subq_10.metric_time__day ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS every_two_days_bookers_fill_nulls_with_0 FROM ( -- Compute Metrics via Expressions SELECT - subq_9.metric_time__day + subq_9.booking__ds__month + , subq_9.metric_time__day , subq_9.metric_time__week - , subq_9.booking__ds__month , COALESCE(subq_9.bookers, 0) AS every_two_days_bookers_fill_nulls_with_0 FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day + DATE_TRUNC('month', subq_7.metric_time__day) AS booking__ds__month + , subq_7.metric_time__day AS metric_time__day , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , subq_6.booking__ds__month AS booking__ds__month , subq_6.bookers AS bookers FROM ( -- Time Spine @@ -380,6 +380,6 @@ FROM ( ) subq_10 ) subq_11 GROUP BY - subq_11.metric_time__week - , subq_11.booking__ds__month + subq_11.booking__ds__month + , subq_11.metric_time__week , subq_11.every_two_days_bookers_fill_nulls_with_0 diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_window_metric_with_non_default_grains__plan0_optimized.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_window_metric_with_non_default_grains__plan0_optimized.sql index 08450420e..417844f92 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_window_metric_with_non_default_grains__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_window_metric_with_non_default_grains__plan0_optimized.sql @@ -8,28 +8,28 @@ sql_engine: Postgres --- -- Re-aggregate Metric via Group By SELECT - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , every_two_days_bookers_fill_nulls_with_0 FROM ( -- Compute Metrics via Expressions -- Window Function for Metric Re-aggregation SELECT - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , FIRST_VALUE(COALESCE(bookers, 0)) OVER ( PARTITION BY - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week ORDER BY metric_time__day ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS every_two_days_bookers_fill_nulls_with_0 FROM ( -- Join to Time Spine Dataset SELECT - subq_20.ds AS metric_time__day + DATE_TRUNC('month', subq_20.ds) AS booking__ds__month + , subq_20.ds AS metric_time__day , DATE_TRUNC('week', subq_20.ds) AS metric_time__week - , subq_18.booking__ds__month AS booking__ds__month , subq_18.bookers AS bookers FROM ***************************.mf_time_spine subq_20 LEFT OUTER JOIN ( @@ -60,6 +60,6 @@ FROM ( ) subq_21 ) subq_23 GROUP BY - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , every_two_days_bookers_fill_nulls_with_0 diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_window_metric_with_non_default_grains__plan0.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_window_metric_with_non_default_grains__plan0.sql index a94d9c967..920c847ed 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_window_metric_with_non_default_grains__plan0.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_window_metric_with_non_default_grains__plan0.sql @@ -8,34 +8,34 @@ sql_engine: Redshift --- -- Re-aggregate Metric via Group By SELECT - subq_11.metric_time__week - , subq_11.booking__ds__month + subq_11.booking__ds__month + , subq_11.metric_time__week , subq_11.every_two_days_bookers_fill_nulls_with_0 FROM ( -- Window Function for Metric Re-aggregation SELECT - subq_10.metric_time__week - , subq_10.booking__ds__month + subq_10.booking__ds__month + , subq_10.metric_time__week , FIRST_VALUE(subq_10.every_two_days_bookers_fill_nulls_with_0) OVER ( PARTITION BY - subq_10.metric_time__week - , subq_10.booking__ds__month + subq_10.booking__ds__month + , subq_10.metric_time__week ORDER BY subq_10.metric_time__day ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS every_two_days_bookers_fill_nulls_with_0 FROM ( -- Compute Metrics via Expressions SELECT - subq_9.metric_time__day + subq_9.booking__ds__month + , subq_9.metric_time__day , subq_9.metric_time__week - , subq_9.booking__ds__month , COALESCE(subq_9.bookers, 0) AS every_two_days_bookers_fill_nulls_with_0 FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day + DATE_TRUNC('month', subq_7.metric_time__day) AS booking__ds__month + , subq_7.metric_time__day AS metric_time__day , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , subq_6.booking__ds__month AS booking__ds__month , subq_6.bookers AS bookers FROM ( -- Time Spine @@ -380,6 +380,6 @@ FROM ( ) subq_10 ) subq_11 GROUP BY - subq_11.metric_time__week - , subq_11.booking__ds__month + subq_11.booking__ds__month + , subq_11.metric_time__week , subq_11.every_two_days_bookers_fill_nulls_with_0 diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_window_metric_with_non_default_grains__plan0_optimized.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_window_metric_with_non_default_grains__plan0_optimized.sql index faffe28b1..5d172a21a 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_window_metric_with_non_default_grains__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_window_metric_with_non_default_grains__plan0_optimized.sql @@ -8,28 +8,28 @@ sql_engine: Redshift --- -- Re-aggregate Metric via Group By SELECT - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , every_two_days_bookers_fill_nulls_with_0 FROM ( -- Compute Metrics via Expressions -- Window Function for Metric Re-aggregation SELECT - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , FIRST_VALUE(COALESCE(bookers, 0)) OVER ( PARTITION BY - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week ORDER BY metric_time__day ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS every_two_days_bookers_fill_nulls_with_0 FROM ( -- Join to Time Spine Dataset SELECT - subq_20.ds AS metric_time__day + DATE_TRUNC('month', subq_20.ds) AS booking__ds__month + , subq_20.ds AS metric_time__day , DATE_TRUNC('week', subq_20.ds) AS metric_time__week - , subq_18.booking__ds__month AS booking__ds__month , subq_18.bookers AS bookers FROM ***************************.mf_time_spine subq_20 LEFT OUTER JOIN ( @@ -60,6 +60,6 @@ FROM ( ) subq_21 ) subq_23 GROUP BY - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , every_two_days_bookers_fill_nulls_with_0 diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_window_metric_with_non_default_grains__plan0.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_window_metric_with_non_default_grains__plan0.sql index f07cc9121..9cdae4011 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_window_metric_with_non_default_grains__plan0.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_window_metric_with_non_default_grains__plan0.sql @@ -8,34 +8,34 @@ sql_engine: Snowflake --- -- Re-aggregate Metric via Group By SELECT - subq_11.metric_time__week - , subq_11.booking__ds__month + subq_11.booking__ds__month + , subq_11.metric_time__week , subq_11.every_two_days_bookers_fill_nulls_with_0 FROM ( -- Window Function for Metric Re-aggregation SELECT - subq_10.metric_time__week - , subq_10.booking__ds__month + subq_10.booking__ds__month + , subq_10.metric_time__week , FIRST_VALUE(subq_10.every_two_days_bookers_fill_nulls_with_0) OVER ( PARTITION BY - subq_10.metric_time__week - , subq_10.booking__ds__month + subq_10.booking__ds__month + , subq_10.metric_time__week ORDER BY subq_10.metric_time__day ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS every_two_days_bookers_fill_nulls_with_0 FROM ( -- Compute Metrics via Expressions SELECT - subq_9.metric_time__day + subq_9.booking__ds__month + , subq_9.metric_time__day , subq_9.metric_time__week - , subq_9.booking__ds__month , COALESCE(subq_9.bookers, 0) AS every_two_days_bookers_fill_nulls_with_0 FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day + DATE_TRUNC('month', subq_7.metric_time__day) AS booking__ds__month + , subq_7.metric_time__day AS metric_time__day , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , subq_6.booking__ds__month AS booking__ds__month , subq_6.bookers AS bookers FROM ( -- Time Spine @@ -380,6 +380,6 @@ FROM ( ) subq_10 ) subq_11 GROUP BY - subq_11.metric_time__week - , subq_11.booking__ds__month + subq_11.booking__ds__month + , subq_11.metric_time__week , subq_11.every_two_days_bookers_fill_nulls_with_0 diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_window_metric_with_non_default_grains__plan0_optimized.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_window_metric_with_non_default_grains__plan0_optimized.sql index a8be656ab..d98ee20cf 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_window_metric_with_non_default_grains__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_window_metric_with_non_default_grains__plan0_optimized.sql @@ -8,28 +8,28 @@ sql_engine: Snowflake --- -- Re-aggregate Metric via Group By SELECT - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , every_two_days_bookers_fill_nulls_with_0 FROM ( -- Compute Metrics via Expressions -- Window Function for Metric Re-aggregation SELECT - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , FIRST_VALUE(COALESCE(bookers, 0)) OVER ( PARTITION BY - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week ORDER BY metric_time__day ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS every_two_days_bookers_fill_nulls_with_0 FROM ( -- Join to Time Spine Dataset SELECT - subq_20.ds AS metric_time__day + DATE_TRUNC('month', subq_20.ds) AS booking__ds__month + , subq_20.ds AS metric_time__day , DATE_TRUNC('week', subq_20.ds) AS metric_time__week - , subq_18.booking__ds__month AS booking__ds__month , subq_18.bookers AS bookers FROM ***************************.mf_time_spine subq_20 LEFT OUTER JOIN ( @@ -60,6 +60,6 @@ FROM ( ) subq_21 ) subq_23 GROUP BY - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , every_two_days_bookers_fill_nulls_with_0 diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_window_metric_with_non_default_grains__plan0.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_window_metric_with_non_default_grains__plan0.sql index 5a85b8a6d..440b3e427 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_window_metric_with_non_default_grains__plan0.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_window_metric_with_non_default_grains__plan0.sql @@ -8,34 +8,34 @@ sql_engine: Trino --- -- Re-aggregate Metric via Group By SELECT - subq_11.metric_time__week - , subq_11.booking__ds__month + subq_11.booking__ds__month + , subq_11.metric_time__week , subq_11.every_two_days_bookers_fill_nulls_with_0 FROM ( -- Window Function for Metric Re-aggregation SELECT - subq_10.metric_time__week - , subq_10.booking__ds__month + subq_10.booking__ds__month + , subq_10.metric_time__week , FIRST_VALUE(subq_10.every_two_days_bookers_fill_nulls_with_0) OVER ( PARTITION BY - subq_10.metric_time__week - , subq_10.booking__ds__month + subq_10.booking__ds__month + , subq_10.metric_time__week ORDER BY subq_10.metric_time__day ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS every_two_days_bookers_fill_nulls_with_0 FROM ( -- Compute Metrics via Expressions SELECT - subq_9.metric_time__day + subq_9.booking__ds__month + , subq_9.metric_time__day , subq_9.metric_time__week - , subq_9.booking__ds__month , COALESCE(subq_9.bookers, 0) AS every_two_days_bookers_fill_nulls_with_0 FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day + DATE_TRUNC('month', subq_7.metric_time__day) AS booking__ds__month + , subq_7.metric_time__day AS metric_time__day , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , subq_6.booking__ds__month AS booking__ds__month , subq_6.bookers AS bookers FROM ( -- Time Spine @@ -380,6 +380,6 @@ FROM ( ) subq_10 ) subq_11 GROUP BY - subq_11.metric_time__week - , subq_11.booking__ds__month + subq_11.booking__ds__month + , subq_11.metric_time__week , subq_11.every_two_days_bookers_fill_nulls_with_0 diff --git a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_window_metric_with_non_default_grains__plan0_optimized.sql b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_window_metric_with_non_default_grains__plan0_optimized.sql index 2787373c0..aa9a15b72 100644 --- a/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_window_metric_with_non_default_grains__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_window_metric_with_non_default_grains__plan0_optimized.sql @@ -8,28 +8,28 @@ sql_engine: Trino --- -- Re-aggregate Metric via Group By SELECT - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , every_two_days_bookers_fill_nulls_with_0 FROM ( -- Compute Metrics via Expressions -- Window Function for Metric Re-aggregation SELECT - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , FIRST_VALUE(COALESCE(bookers, 0)) OVER ( PARTITION BY - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week ORDER BY metric_time__day ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING ) AS every_two_days_bookers_fill_nulls_with_0 FROM ( -- Join to Time Spine Dataset SELECT - subq_20.ds AS metric_time__day + DATE_TRUNC('month', subq_20.ds) AS booking__ds__month + , subq_20.ds AS metric_time__day , DATE_TRUNC('week', subq_20.ds) AS metric_time__week - , subq_18.booking__ds__month AS booking__ds__month , subq_18.bookers AS bookers FROM ***************************.mf_time_spine subq_20 LEFT OUTER JOIN ( @@ -60,6 +60,6 @@ FROM ( ) subq_21 ) subq_23 GROUP BY - metric_time__week - , booking__ds__month + booking__ds__month + , metric_time__week , every_two_days_bookers_fill_nulls_with_0 diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_offset_metric_with_custom_granularity__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_offset_metric_with_custom_granularity__plan0.sql index 944c04ae2..6f44b7dd3 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_offset_metric_with_custom_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_offset_metric_with_custom_granularity__plan0.sql @@ -26,16 +26,6 @@ FROM ( -- Join to Custom Granularity Dataset SELECT subq_2.booking__ds__day AS booking__ds__day - , DATETIME_TRUNC(subq_2.booking__ds__day, isoweek) AS booking__ds__week - , DATETIME_TRUNC(subq_2.booking__ds__day, month) AS booking__ds__month - , DATETIME_TRUNC(subq_2.booking__ds__day, quarter) AS booking__ds__quarter - , DATETIME_TRUNC(subq_2.booking__ds__day, year) AS booking__ds__year - , EXTRACT(year FROM subq_2.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_2.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_2.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_2.booking__ds__day) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM subq_2.booking__ds__day) = 1, 7, EXTRACT(dayofweek FROM subq_2.booking__ds__day) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM subq_2.booking__ds__day) AS booking__ds__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -69,6 +59,16 @@ FROM ( , subq_1.paid_at__extract_day AS paid_at__extract_day , subq_1.paid_at__extract_dow AS paid_at__extract_dow , subq_1.paid_at__extract_doy AS paid_at__extract_doy + , subq_1.booking__ds__week AS booking__ds__week + , subq_1.booking__ds__month AS booking__ds__month + , subq_1.booking__ds__quarter AS booking__ds__quarter + , subq_1.booking__ds__year AS booking__ds__year + , subq_1.booking__ds__extract_year AS booking__ds__extract_year + , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_1.booking__ds__extract_month AS booking__ds__extract_month + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql index c0581a4f2..28c4d122e 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/BigQuery/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql @@ -26,16 +26,6 @@ FROM ( SELECT subq_5.metric_time__martian_day , subq_5.metric_time__day - , subq_5.metric_time__week - , subq_5.metric_time__month - , subq_5.metric_time__quarter - , subq_5.metric_time__year - , subq_5.metric_time__extract_year - , subq_5.metric_time__extract_quarter - , subq_5.metric_time__extract_month - , subq_5.metric_time__extract_day - , subq_5.metric_time__extract_dow - , subq_5.metric_time__extract_doy , subq_5.ds__day , subq_5.ds__week , subq_5.ds__month @@ -102,6 +92,16 @@ FROM ( , subq_5.booking__paid_at__extract_day , subq_5.booking__paid_at__extract_dow , subq_5.booking__paid_at__extract_doy + , subq_5.metric_time__week + , subq_5.metric_time__month + , subq_5.metric_time__quarter + , subq_5.metric_time__year + , subq_5.metric_time__extract_year + , subq_5.metric_time__extract_quarter + , subq_5.metric_time__extract_month + , subq_5.metric_time__extract_day + , subq_5.metric_time__extract_dow + , subq_5.metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -128,16 +128,6 @@ FROM ( -- Join to Custom Granularity Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_2.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_2.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -204,6 +194,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_offset_metric_with_custom_granularity__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_offset_metric_with_custom_granularity__plan0.sql index 21cbbc82f..7d623cb6e 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_offset_metric_with_custom_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_offset_metric_with_custom_granularity__plan0.sql @@ -26,16 +26,6 @@ FROM ( -- Join to Custom Granularity Dataset SELECT subq_2.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_2.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_2.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_2.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_2.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_2.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_2.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_2.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_2.booking__ds__day) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_2.booking__ds__day) AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_2.booking__ds__day) AS booking__ds__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -69,6 +59,16 @@ FROM ( , subq_1.paid_at__extract_day AS paid_at__extract_day , subq_1.paid_at__extract_dow AS paid_at__extract_dow , subq_1.paid_at__extract_doy AS paid_at__extract_doy + , subq_1.booking__ds__week AS booking__ds__week + , subq_1.booking__ds__month AS booking__ds__month + , subq_1.booking__ds__quarter AS booking__ds__quarter + , subq_1.booking__ds__year AS booking__ds__year + , subq_1.booking__ds__extract_year AS booking__ds__extract_year + , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_1.booking__ds__extract_month AS booking__ds__extract_month + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql index 672b0c3c3..ac0ae630e 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Databricks/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql @@ -26,16 +26,6 @@ FROM ( SELECT subq_5.metric_time__martian_day , subq_5.metric_time__day - , subq_5.metric_time__week - , subq_5.metric_time__month - , subq_5.metric_time__quarter - , subq_5.metric_time__year - , subq_5.metric_time__extract_year - , subq_5.metric_time__extract_quarter - , subq_5.metric_time__extract_month - , subq_5.metric_time__extract_day - , subq_5.metric_time__extract_dow - , subq_5.metric_time__extract_doy , subq_5.ds__day , subq_5.ds__week , subq_5.ds__month @@ -102,6 +92,16 @@ FROM ( , subq_5.booking__paid_at__extract_day , subq_5.booking__paid_at__extract_dow , subq_5.booking__paid_at__extract_doy + , subq_5.metric_time__week + , subq_5.metric_time__month + , subq_5.metric_time__quarter + , subq_5.metric_time__year + , subq_5.metric_time__extract_year + , subq_5.metric_time__extract_quarter + , subq_5.metric_time__extract_month + , subq_5.metric_time__extract_day + , subq_5.metric_time__extract_dow + , subq_5.metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -128,16 +128,6 @@ FROM ( -- Join to Custom Granularity Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -204,6 +194,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_offset_metric_with_custom_granularity__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_offset_metric_with_custom_granularity__plan0.sql index dab0635e8..6b1d555e9 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_offset_metric_with_custom_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_offset_metric_with_custom_granularity__plan0.sql @@ -26,16 +26,6 @@ FROM ( -- Join to Custom Granularity Dataset SELECT subq_2.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_2.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_2.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_2.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_2.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_2.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_2.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_2.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_2.booking__ds__day) AS booking__ds__extract_day - , EXTRACT(isodow FROM subq_2.booking__ds__day) AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_2.booking__ds__day) AS booking__ds__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -69,6 +59,16 @@ FROM ( , subq_1.paid_at__extract_day AS paid_at__extract_day , subq_1.paid_at__extract_dow AS paid_at__extract_dow , subq_1.paid_at__extract_doy AS paid_at__extract_doy + , subq_1.booking__ds__week AS booking__ds__week + , subq_1.booking__ds__month AS booking__ds__month + , subq_1.booking__ds__quarter AS booking__ds__quarter + , subq_1.booking__ds__year AS booking__ds__year + , subq_1.booking__ds__extract_year AS booking__ds__extract_year + , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_1.booking__ds__extract_month AS booking__ds__extract_month + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql index 4c9d86d58..5c84225ec 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/DuckDB/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql @@ -26,16 +26,6 @@ FROM ( SELECT subq_5.metric_time__martian_day , subq_5.metric_time__day - , subq_5.metric_time__week - , subq_5.metric_time__month - , subq_5.metric_time__quarter - , subq_5.metric_time__year - , subq_5.metric_time__extract_year - , subq_5.metric_time__extract_quarter - , subq_5.metric_time__extract_month - , subq_5.metric_time__extract_day - , subq_5.metric_time__extract_dow - , subq_5.metric_time__extract_doy , subq_5.ds__day , subq_5.ds__week , subq_5.ds__month @@ -102,6 +92,16 @@ FROM ( , subq_5.booking__paid_at__extract_day , subq_5.booking__paid_at__extract_dow , subq_5.booking__paid_at__extract_doy + , subq_5.metric_time__week + , subq_5.metric_time__month + , subq_5.metric_time__quarter + , subq_5.metric_time__year + , subq_5.metric_time__extract_year + , subq_5.metric_time__extract_quarter + , subq_5.metric_time__extract_month + , subq_5.metric_time__extract_day + , subq_5.metric_time__extract_dow + , subq_5.metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -128,16 +128,6 @@ FROM ( -- Join to Custom Granularity Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -204,6 +194,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_offset_metric_with_custom_granularity__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_offset_metric_with_custom_granularity__plan0.sql index 5b948cbb8..e1141a251 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_offset_metric_with_custom_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_offset_metric_with_custom_granularity__plan0.sql @@ -26,16 +26,6 @@ FROM ( -- Join to Custom Granularity Dataset SELECT subq_2.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_2.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_2.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_2.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_2.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_2.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_2.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_2.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_2.booking__ds__day) AS booking__ds__extract_day - , EXTRACT(isodow FROM subq_2.booking__ds__day) AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_2.booking__ds__day) AS booking__ds__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -69,6 +59,16 @@ FROM ( , subq_1.paid_at__extract_day AS paid_at__extract_day , subq_1.paid_at__extract_dow AS paid_at__extract_dow , subq_1.paid_at__extract_doy AS paid_at__extract_doy + , subq_1.booking__ds__week AS booking__ds__week + , subq_1.booking__ds__month AS booking__ds__month + , subq_1.booking__ds__quarter AS booking__ds__quarter + , subq_1.booking__ds__year AS booking__ds__year + , subq_1.booking__ds__extract_year AS booking__ds__extract_year + , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_1.booking__ds__extract_month AS booking__ds__extract_month + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql index 34f0c3329..8f4617d28 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Postgres/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql @@ -26,16 +26,6 @@ FROM ( SELECT subq_5.metric_time__martian_day , subq_5.metric_time__day - , subq_5.metric_time__week - , subq_5.metric_time__month - , subq_5.metric_time__quarter - , subq_5.metric_time__year - , subq_5.metric_time__extract_year - , subq_5.metric_time__extract_quarter - , subq_5.metric_time__extract_month - , subq_5.metric_time__extract_day - , subq_5.metric_time__extract_dow - , subq_5.metric_time__extract_doy , subq_5.ds__day , subq_5.ds__week , subq_5.ds__month @@ -102,6 +92,16 @@ FROM ( , subq_5.booking__paid_at__extract_day , subq_5.booking__paid_at__extract_dow , subq_5.booking__paid_at__extract_doy + , subq_5.metric_time__week + , subq_5.metric_time__month + , subq_5.metric_time__quarter + , subq_5.metric_time__year + , subq_5.metric_time__extract_year + , subq_5.metric_time__extract_quarter + , subq_5.metric_time__extract_month + , subq_5.metric_time__extract_day + , subq_5.metric_time__extract_dow + , subq_5.metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -128,16 +128,6 @@ FROM ( -- Join to Custom Granularity Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -204,6 +194,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_offset_metric_with_custom_granularity__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_offset_metric_with_custom_granularity__plan0.sql index b3c8a539a..f79cb4c36 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_offset_metric_with_custom_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_offset_metric_with_custom_granularity__plan0.sql @@ -26,16 +26,6 @@ FROM ( -- Join to Custom Granularity Dataset SELECT subq_2.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_2.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_2.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_2.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_2.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_2.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_2.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_2.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_2.booking__ds__day) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM subq_2.booking__ds__day) = 0 THEN EXTRACT(dow FROM subq_2.booking__ds__day) + 7 ELSE EXTRACT(dow FROM subq_2.booking__ds__day) END AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_2.booking__ds__day) AS booking__ds__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -69,6 +59,16 @@ FROM ( , subq_1.paid_at__extract_day AS paid_at__extract_day , subq_1.paid_at__extract_dow AS paid_at__extract_dow , subq_1.paid_at__extract_doy AS paid_at__extract_doy + , subq_1.booking__ds__week AS booking__ds__week + , subq_1.booking__ds__month AS booking__ds__month + , subq_1.booking__ds__quarter AS booking__ds__quarter + , subq_1.booking__ds__year AS booking__ds__year + , subq_1.booking__ds__extract_year AS booking__ds__extract_year + , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_1.booking__ds__extract_month AS booking__ds__extract_month + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql index 770f90b5c..45f2fbc06 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Redshift/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql @@ -26,16 +26,6 @@ FROM ( SELECT subq_5.metric_time__martian_day , subq_5.metric_time__day - , subq_5.metric_time__week - , subq_5.metric_time__month - , subq_5.metric_time__quarter - , subq_5.metric_time__year - , subq_5.metric_time__extract_year - , subq_5.metric_time__extract_quarter - , subq_5.metric_time__extract_month - , subq_5.metric_time__extract_day - , subq_5.metric_time__extract_dow - , subq_5.metric_time__extract_doy , subq_5.ds__day , subq_5.ds__week , subq_5.ds__month @@ -102,6 +92,16 @@ FROM ( , subq_5.booking__paid_at__extract_day , subq_5.booking__paid_at__extract_dow , subq_5.booking__paid_at__extract_doy + , subq_5.metric_time__week + , subq_5.metric_time__month + , subq_5.metric_time__quarter + , subq_5.metric_time__year + , subq_5.metric_time__extract_year + , subq_5.metric_time__extract_quarter + , subq_5.metric_time__extract_month + , subq_5.metric_time__extract_day + , subq_5.metric_time__extract_dow + , subq_5.metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -128,16 +128,6 @@ FROM ( -- Join to Custom Granularity Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_2.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_2.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_2.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -204,6 +194,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_offset_metric_with_custom_granularity__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_offset_metric_with_custom_granularity__plan0.sql index 2d27633c4..6a98a77a1 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_offset_metric_with_custom_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_offset_metric_with_custom_granularity__plan0.sql @@ -26,16 +26,6 @@ FROM ( -- Join to Custom Granularity Dataset SELECT subq_2.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_2.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_2.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_2.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_2.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_2.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_2.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_2.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_2.booking__ds__day) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM subq_2.booking__ds__day) AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_2.booking__ds__day) AS booking__ds__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -69,6 +59,16 @@ FROM ( , subq_1.paid_at__extract_day AS paid_at__extract_day , subq_1.paid_at__extract_dow AS paid_at__extract_dow , subq_1.paid_at__extract_doy AS paid_at__extract_doy + , subq_1.booking__ds__week AS booking__ds__week + , subq_1.booking__ds__month AS booking__ds__month + , subq_1.booking__ds__quarter AS booking__ds__quarter + , subq_1.booking__ds__year AS booking__ds__year + , subq_1.booking__ds__extract_year AS booking__ds__extract_year + , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_1.booking__ds__extract_month AS booking__ds__extract_month + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql index c9b3f8ab3..58a022c87 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Snowflake/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql @@ -26,16 +26,6 @@ FROM ( SELECT subq_5.metric_time__martian_day , subq_5.metric_time__day - , subq_5.metric_time__week - , subq_5.metric_time__month - , subq_5.metric_time__quarter - , subq_5.metric_time__year - , subq_5.metric_time__extract_year - , subq_5.metric_time__extract_quarter - , subq_5.metric_time__extract_month - , subq_5.metric_time__extract_day - , subq_5.metric_time__extract_dow - , subq_5.metric_time__extract_doy , subq_5.ds__day , subq_5.ds__week , subq_5.ds__month @@ -102,6 +92,16 @@ FROM ( , subq_5.booking__paid_at__extract_day , subq_5.booking__paid_at__extract_dow , subq_5.booking__paid_at__extract_doy + , subq_5.metric_time__week + , subq_5.metric_time__month + , subq_5.metric_time__quarter + , subq_5.metric_time__year + , subq_5.metric_time__extract_year + , subq_5.metric_time__extract_quarter + , subq_5.metric_time__extract_month + , subq_5.metric_time__extract_day + , subq_5.metric_time__extract_dow + , subq_5.metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -128,16 +128,6 @@ FROM ( -- Join to Custom Granularity Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -204,6 +194,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_offset_metric_with_custom_granularity__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_offset_metric_with_custom_granularity__plan0.sql index b1acbbb39..c0e42d0d6 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_offset_metric_with_custom_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_offset_metric_with_custom_granularity__plan0.sql @@ -26,16 +26,6 @@ FROM ( -- Join to Custom Granularity Dataset SELECT subq_2.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_2.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_2.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_2.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_2.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_2.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_2.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_2.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_2.booking__ds__day) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_2.booking__ds__day) AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_2.booking__ds__day) AS booking__ds__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -69,6 +59,16 @@ FROM ( , subq_1.paid_at__extract_day AS paid_at__extract_day , subq_1.paid_at__extract_dow AS paid_at__extract_dow , subq_1.paid_at__extract_doy AS paid_at__extract_doy + , subq_1.booking__ds__week AS booking__ds__week + , subq_1.booking__ds__month AS booking__ds__month + , subq_1.booking__ds__quarter AS booking__ds__quarter + , subq_1.booking__ds__year AS booking__ds__year + , subq_1.booking__ds__extract_year AS booking__ds__extract_year + , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_1.booking__ds__extract_month AS booking__ds__extract_month + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql index fb29efa35..6ddbbbdaf 100644 --- a/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql +++ b/tests_metricflow/snapshots/test_custom_granularity.py/SqlQueryPlan/Trino/test_offset_metric_with_custom_granularity_filter_not_in_group_by__plan0.sql @@ -26,16 +26,6 @@ FROM ( SELECT subq_5.metric_time__martian_day , subq_5.metric_time__day - , subq_5.metric_time__week - , subq_5.metric_time__month - , subq_5.metric_time__quarter - , subq_5.metric_time__year - , subq_5.metric_time__extract_year - , subq_5.metric_time__extract_quarter - , subq_5.metric_time__extract_month - , subq_5.metric_time__extract_day - , subq_5.metric_time__extract_dow - , subq_5.metric_time__extract_doy , subq_5.ds__day , subq_5.ds__week , subq_5.ds__month @@ -102,6 +92,16 @@ FROM ( , subq_5.booking__paid_at__extract_day , subq_5.booking__paid_at__extract_dow , subq_5.booking__paid_at__extract_doy + , subq_5.metric_time__week + , subq_5.metric_time__month + , subq_5.metric_time__quarter + , subq_5.metric_time__year + , subq_5.metric_time__extract_year + , subq_5.metric_time__extract_quarter + , subq_5.metric_time__extract_month + , subq_5.metric_time__extract_day + , subq_5.metric_time__extract_dow + , subq_5.metric_time__extract_doy , subq_5.listing , subq_5.guest , subq_5.host @@ -128,16 +128,6 @@ FROM ( -- Join to Custom Granularity Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -204,6 +194,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql index 455548480..e28bc9828 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Constrain Time Range to [2019-12-19T00:00:00, 2020-01-02T00:00:00] SELECT subq_7.metric_time__day - , subq_7.metric_time__week - , subq_7.metric_time__month - , subq_7.metric_time__quarter - , subq_7.metric_time__year - , subq_7.metric_time__extract_year - , subq_7.metric_time__extract_quarter - , subq_7.metric_time__extract_month - , subq_7.metric_time__extract_day - , subq_7.metric_time__extract_dow - , subq_7.metric_time__extract_doy , subq_7.ds__day , subq_7.ds__week , subq_7.ds__month @@ -101,6 +91,16 @@ FROM ( , subq_7.booking__paid_at__extract_day , subq_7.booking__paid_at__extract_dow , subq_7.booking__paid_at__extract_doy + , subq_7.metric_time__week + , subq_7.metric_time__month + , subq_7.metric_time__quarter + , subq_7.metric_time__year + , subq_7.metric_time__extract_year + , subq_7.metric_time__extract_quarter + , subq_7.metric_time__extract_month + , subq_7.metric_time__extract_day + , subq_7.metric_time__extract_dow + , subq_7.metric_time__extract_doy , subq_7.listing , subq_7.guest , subq_7.host @@ -126,16 +126,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_5.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_5.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_5.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_5.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_5.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_5.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_5.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_5.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_5.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_5.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_5.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_5.metric_time__day) AS 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 @@ -202,6 +192,16 @@ FROM ( , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , 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.guest AS guest , subq_4.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql index 4197903d8..aa69ae70d 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql @@ -25,11 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__month AS metric_time__month - , DATETIME_TRUNC(subq_2.metric_time__month, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_2.metric_time__month, year) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__month) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__month) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__month) AS metric_time__extract_month , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year @@ -42,6 +37,11 @@ FROM ( , subq_1.booking_monthly__ds__extract_year AS booking_monthly__ds__extract_year , subq_1.booking_monthly__ds__extract_quarter AS booking_monthly__ds__extract_quarter , subq_1.booking_monthly__ds__extract_month AS booking_monthly__ds__extract_month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month , subq_1.listing AS listing , subq_1.booking_monthly__listing AS booking_monthly__listing , subq_1.bookings_monthly AS bookings_monthly diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql index 03cb0c964..766c84131 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_7.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_7.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_7.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_7.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_7.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_7.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_7.metric_time__day) AS metric_time__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index dfea0e70a..f4c27482d 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -245,17 +245,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_7.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_7.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_7.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_7.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_7.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_7.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_7.metric_time__day) AS metric_time__extract_doy + DATETIME_TRUNC(subq_7.metric_time__day, isoweek) AS metric_time__week , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__day AS metric_time__day + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql index ab78f5349..4315352dd 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_7.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_7.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_7.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_7.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_7.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_7.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_7.metric_time__day) AS metric_time__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql index b2418c319..8dab694d7 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -245,17 +245,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_7.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_7.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_7.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_7.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_7.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_7.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_7.metric_time__day) AS metric_time__extract_doy + DATETIME_TRUNC(subq_7.metric_time__day, quarter) AS metric_time__quarter , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__day AS metric_time__day + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index d855e9f1e..e2891b8c7 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -31,16 +31,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_2.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_2.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -107,6 +97,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -356,16 +356,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_10.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_10.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_10.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_10.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_10.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_10.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_10.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_10.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_10.metric_time__day) AS metric_time__extract_doy , subq_9.ds__day AS ds__day , subq_9.ds__week AS ds__week , subq_9.ds__month AS ds__month @@ -432,6 +422,16 @@ FROM ( , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_9.metric_time__week AS metric_time__week + , subq_9.metric_time__month AS metric_time__month + , subq_9.metric_time__quarter AS metric_time__quarter + , subq_9.metric_time__year AS metric_time__year + , subq_9.metric_time__extract_year AS metric_time__extract_year + , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_9.metric_time__extract_month AS metric_time__extract_month + , subq_9.metric_time__extract_day AS metric_time__extract_day + , subq_9.metric_time__extract_dow AS metric_time__extract_dow + , subq_9.metric_time__extract_doy AS metric_time__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index eb13c7d7c..801310a99 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -30,17 +30,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_2.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_2.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_2.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_2.metric_time__day) AS metric_time__extract_doy + DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -107,6 +97,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -356,17 +356,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_10.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_10.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_10.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_10.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_10.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_10.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_10.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_10.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_10.metric_time__day) AS metric_time__extract_doy + DATETIME_TRUNC(subq_10.metric_time__day, year) AS metric_time__year , subq_9.ds__day AS ds__day , subq_9.ds__week AS ds__week , subq_9.ds__month AS ds__month @@ -433,6 +423,16 @@ FROM ( , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_9.metric_time__day AS metric_time__day + , subq_9.metric_time__week AS metric_time__week + , subq_9.metric_time__month AS metric_time__month + , subq_9.metric_time__quarter AS metric_time__quarter + , subq_9.metric_time__extract_year AS metric_time__extract_year + , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_9.metric_time__extract_month AS metric_time__extract_month + , subq_9.metric_time__extract_day AS metric_time__extract_day + , subq_9.metric_time__extract_dow AS metric_time__extract_dow + , subq_9.metric_time__extract_doy AS metric_time__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0.sql index 9b1c01273..381f3d287 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0.sql @@ -349,16 +349,6 @@ FROM ( -- Constrain Output with WHERE SELECT subq_10.metric_time__day - , subq_10.metric_time__week - , subq_10.metric_time__month - , subq_10.metric_time__quarter - , subq_10.metric_time__year - , subq_10.metric_time__extract_year - , subq_10.metric_time__extract_quarter - , subq_10.metric_time__extract_month - , subq_10.metric_time__extract_day - , subq_10.metric_time__extract_dow - , subq_10.metric_time__extract_doy , subq_10.ds__day , subq_10.ds__week , subq_10.ds__month @@ -425,6 +415,16 @@ FROM ( , subq_10.booking__paid_at__extract_day , subq_10.booking__paid_at__extract_dow , subq_10.booking__paid_at__extract_doy + , subq_10.metric_time__week + , subq_10.metric_time__month + , subq_10.metric_time__quarter + , subq_10.metric_time__year + , subq_10.metric_time__extract_year + , subq_10.metric_time__extract_quarter + , subq_10.metric_time__extract_month + , subq_10.metric_time__extract_day + , subq_10.metric_time__extract_dow + , subq_10.metric_time__extract_doy , subq_10.listing , subq_10.guest , subq_10.host @@ -450,16 +450,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_8.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_8.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_8.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_8.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_8.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_8.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_8.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_8.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_8.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_8.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_8.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_8.metric_time__day) AS metric_time__extract_doy , subq_7.ds__day AS ds__day , subq_7.ds__week AS ds__week , subq_7.ds__month AS ds__month @@ -526,6 +516,16 @@ FROM ( , subq_7.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_7.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_7.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_7.metric_time__week AS metric_time__week + , subq_7.metric_time__month AS metric_time__month + , subq_7.metric_time__quarter AS metric_time__quarter + , subq_7.metric_time__year AS metric_time__year + , subq_7.metric_time__extract_year AS metric_time__extract_year + , subq_7.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_7.metric_time__extract_month AS metric_time__extract_month + , 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_7.listing AS listing , subq_7.guest AS guest , subq_7.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql index d4663973a..c9c070bfe 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_5.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_5.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_5.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_5.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_5.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_5.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_5.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_5.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_5.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_5.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_5.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_5.metric_time__day) AS 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 @@ -101,6 +91,16 @@ FROM ( , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , 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.guest AS guest , subq_4.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0.sql index 1df7cab10..c4a927f4a 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0.sql @@ -31,16 +31,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.booking__ds__day AS booking__ds__day - , DATETIME_TRUNC(subq_2.booking__ds__day, isoweek) AS booking__ds__week - , DATETIME_TRUNC(subq_2.booking__ds__day, month) AS booking__ds__month - , DATETIME_TRUNC(subq_2.booking__ds__day, quarter) AS booking__ds__quarter - , DATETIME_TRUNC(subq_2.booking__ds__day, year) AS booking__ds__year - , EXTRACT(year FROM subq_2.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_2.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_2.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_2.booking__ds__day) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM subq_2.booking__ds__day) = 1, 7, EXTRACT(dayofweek FROM subq_2.booking__ds__day) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM subq_2.booking__ds__day) AS booking__ds__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -74,6 +64,16 @@ FROM ( , subq_1.paid_at__extract_day AS paid_at__extract_day , subq_1.paid_at__extract_dow AS paid_at__extract_dow , subq_1.paid_at__extract_doy AS paid_at__extract_doy + , subq_1.booking__ds__week AS booking__ds__week + , subq_1.booking__ds__month AS booking__ds__month + , subq_1.booking__ds__quarter AS booking__ds__quarter + , subq_1.booking__ds__year AS booking__ds__year + , subq_1.booking__ds__extract_year AS booking__ds__extract_year + , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_1.booking__ds__extract_month AS booking__ds__extract_month + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql index 2982c1015..a95c8aa4e 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_2.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_2.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -101,6 +91,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql index f468b603e..325401084 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql @@ -57,16 +57,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_2.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_2.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -133,6 +123,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0.sql index 4d4830152..a1f9b0034 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0.sql @@ -41,16 +41,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_2.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_2.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -117,6 +107,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0.sql index 976fcea6f..3525bf5d9 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0.sql @@ -42,16 +42,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_2.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_2.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -118,6 +108,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0.sql index 3c351fcf5..d368d1cc0 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0.sql @@ -46,16 +46,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_2.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_2.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -122,6 +112,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql index 40f11b475..3f77db76a 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql @@ -26,17 +26,7 @@ FROM ( FROM ( -- Constrain Output with WHERE SELECT - subq_4.metric_time__day - , subq_4.metric_time__week - , subq_4.metric_time__month - , subq_4.metric_time__quarter - , subq_4.metric_time__year - , subq_4.metric_time__extract_year - , subq_4.metric_time__extract_quarter - , subq_4.metric_time__extract_month - , subq_4.metric_time__extract_day - , subq_4.metric_time__extract_dow - , subq_4.metric_time__extract_doy + subq_4.metric_time__month , subq_4.ds__day , subq_4.ds__week , subq_4.ds__month @@ -103,6 +93,16 @@ FROM ( , subq_4.booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy + , subq_4.metric_time__day + , subq_4.metric_time__week + , subq_4.metric_time__quarter + , subq_4.metric_time__year + , subq_4.metric_time__extract_year + , subq_4.metric_time__extract_quarter + , subq_4.metric_time__extract_month + , subq_4.metric_time__extract_day + , subq_4.metric_time__extract_dow + , subq_4.metric_time__extract_doy , subq_4.listing , subq_4.guest , subq_4.host @@ -127,17 +127,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_2.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_2.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_2.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_2.metric_time__day) AS metric_time__extract_doy + DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -204,6 +194,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql index 9b2141086..bce15e070 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql @@ -19,8 +19,8 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_12.ds AS metric_time__day - , DATETIME_TRUNC(subq_12.ds, month) AS metric_time__month + DATETIME_TRUNC(subq_12.ds, month) AS metric_time__month + , subq_10.metric_time__day AS metric_time__day , subq_10.bookings AS bookings FROM ***************************.mf_time_spine subq_12 INNER JOIN ( diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_multiple_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_multiple_granularities__plan0.sql index 306245462..a83cd1f6d 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_multiple_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_metric_multiple_granularities__plan0.sql @@ -35,16 +35,8 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_2.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_2.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -111,6 +103,14 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0.sql index badbaea8f..df697c26c 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.booking__ds__day AS booking__ds__day - , DATETIME_TRUNC(subq_7.booking__ds__day, isoweek) AS booking__ds__week - , DATETIME_TRUNC(subq_7.booking__ds__day, month) AS booking__ds__month - , DATETIME_TRUNC(subq_7.booking__ds__day, quarter) AS booking__ds__quarter - , DATETIME_TRUNC(subq_7.booking__ds__day, year) AS booking__ds__year - , EXTRACT(year FROM subq_7.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_7.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_7.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_7.booking__ds__day) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM subq_7.booking__ds__day) = 1, 7, EXTRACT(dayofweek FROM subq_7.booking__ds__day) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM subq_7.booking__ds__day) AS booking__ds__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -289,6 +279,16 @@ FROM ( , subq_6.paid_at__extract_day AS paid_at__extract_day , subq_6.paid_at__extract_dow AS paid_at__extract_dow , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , subq_6.booking__ds__week AS booking__ds__week + , subq_6.booking__ds__month AS booking__ds__month + , subq_6.booking__ds__quarter AS booking__ds__quarter + , subq_6.booking__ds__year AS booking__ds__year + , subq_6.booking__ds__extract_year AS booking__ds__extract_year + , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_6.booking__ds__extract_month AS booking__ds__extract_month + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql index dc10f38bd..8c53a7d0a 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql @@ -32,17 +32,7 @@ FROM ( FROM ( -- Constrain Output with WHERE SELECT - subq_4.metric_time__day - , subq_4.metric_time__week - , subq_4.metric_time__month - , subq_4.metric_time__quarter - , subq_4.metric_time__year - , subq_4.metric_time__extract_year - , subq_4.metric_time__extract_quarter - , subq_4.metric_time__extract_month - , subq_4.metric_time__extract_day - , subq_4.metric_time__extract_dow - , subq_4.metric_time__extract_doy + subq_4.metric_time__month , subq_4.ds__day , subq_4.ds__week , subq_4.ds__month @@ -109,6 +99,16 @@ FROM ( , subq_4.booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy + , subq_4.metric_time__day + , subq_4.metric_time__week + , subq_4.metric_time__quarter + , subq_4.metric_time__year + , subq_4.metric_time__extract_year + , subq_4.metric_time__extract_quarter + , subq_4.metric_time__extract_month + , subq_4.metric_time__extract_day + , subq_4.metric_time__extract_dow + , subq_4.metric_time__extract_doy , subq_4.listing , subq_4.guest , subq_4.host @@ -133,17 +133,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_2.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_2.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_2.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_2.metric_time__day) AS metric_time__extract_doy + DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -210,6 +200,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql index 73536fe94..f58300038 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql @@ -25,8 +25,8 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_19.ds AS metric_time__day - , DATETIME_TRUNC(subq_19.ds, month) AS metric_time__month + DATETIME_TRUNC(subq_19.ds, month) AS metric_time__month + , DATETIME_TRUNC(bookings_source_src_28000.ds, day) AS metric_time__day , bookings_source_src_28000.booking_value AS booking_value FROM ***************************.mf_time_spine subq_19 INNER JOIN diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_multiple_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_multiple_granularities__plan0.sql index c8630a4c7..ae94bb921 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_multiple_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_metric_multiple_granularities__plan0.sql @@ -43,16 +43,8 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_2.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_2.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -119,6 +111,14 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0.sql index a0ef99cfd..20dfb7835 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.booking__ds__day AS booking__ds__day - , DATETIME_TRUNC(subq_7.booking__ds__day, isoweek) AS booking__ds__week - , DATETIME_TRUNC(subq_7.booking__ds__day, month) AS booking__ds__month - , DATETIME_TRUNC(subq_7.booking__ds__day, quarter) AS booking__ds__quarter - , DATETIME_TRUNC(subq_7.booking__ds__day, year) AS booking__ds__year - , EXTRACT(year FROM subq_7.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_7.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_7.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_7.booking__ds__day) AS booking__ds__extract_day - , IF(EXTRACT(dayofweek FROM subq_7.booking__ds__day) = 1, 7, EXTRACT(dayofweek FROM subq_7.booking__ds__day) - 1) AS booking__ds__extract_dow - , EXTRACT(dayofyear FROM subq_7.booking__ds__day) AS booking__ds__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -289,6 +279,16 @@ FROM ( , subq_6.paid_at__extract_day AS paid_at__extract_day , subq_6.paid_at__extract_dow AS paid_at__extract_dow , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , subq_6.booking__ds__week AS booking__ds__week + , subq_6.booking__ds__month AS booking__ds__month + , subq_6.booking__ds__quarter AS booking__ds__quarter + , subq_6.booking__ds__year AS booking__ds__year + , subq_6.booking__ds__extract_year AS booking__ds__extract_year + , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_6.booking__ds__extract_month AS booking__ds__extract_month + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0.sql index fa9169c91..cd4f97213 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_2.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_2.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_2.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_2.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_2.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_2.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -101,6 +91,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql index 7b2561e64..16ffa2692 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Constrain Time Range to [2019-12-19T00:00:00, 2020-01-02T00:00:00] SELECT subq_7.metric_time__day - , subq_7.metric_time__week - , subq_7.metric_time__month - , subq_7.metric_time__quarter - , subq_7.metric_time__year - , subq_7.metric_time__extract_year - , subq_7.metric_time__extract_quarter - , subq_7.metric_time__extract_month - , subq_7.metric_time__extract_day - , subq_7.metric_time__extract_dow - , subq_7.metric_time__extract_doy , subq_7.ds__day , subq_7.ds__week , subq_7.ds__month @@ -101,6 +91,16 @@ FROM ( , subq_7.booking__paid_at__extract_day , subq_7.booking__paid_at__extract_dow , subq_7.booking__paid_at__extract_doy + , subq_7.metric_time__week + , subq_7.metric_time__month + , subq_7.metric_time__quarter + , subq_7.metric_time__year + , subq_7.metric_time__extract_year + , subq_7.metric_time__extract_quarter + , subq_7.metric_time__extract_month + , subq_7.metric_time__extract_day + , subq_7.metric_time__extract_dow + , subq_7.metric_time__extract_doy , subq_7.listing , subq_7.guest , subq_7.host @@ -126,16 +126,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_5.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_5.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_5.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_5.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_5.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_5.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_5.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_5.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_5.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_5.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_5.metric_time__day) AS 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 @@ -202,6 +192,16 @@ FROM ( , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , 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.guest AS guest , subq_4.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql index 6118addb8..5acb3e5d8 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql @@ -25,11 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__month AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__month) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__month) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__month) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__month) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__month) AS metric_time__extract_month , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year @@ -42,6 +37,11 @@ FROM ( , subq_1.booking_monthly__ds__extract_year AS booking_monthly__ds__extract_year , subq_1.booking_monthly__ds__extract_quarter AS booking_monthly__ds__extract_quarter , subq_1.booking_monthly__ds__extract_month AS booking_monthly__ds__extract_month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month , subq_1.listing AS listing , subq_1.booking_monthly__listing AS booking_monthly__listing , subq_1.bookings_monthly AS bookings_monthly diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0.sql index e634ee21b..7d7aa9351 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index ea7afdaf5..f792d1ab0 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -245,17 +245,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__day AS metric_time__day + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0.sql index 25f372d89..fdd749b31 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0.sql index bd515b35c..afb647f8a 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -245,17 +245,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__day AS metric_time__day + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index 29cbdafdc..d4ade9d2b 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -31,16 +31,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -107,6 +97,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -356,16 +356,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_10.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_10.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_10.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_10.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_10.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_10.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_10.metric_time__day) AS metric_time__extract_doy , subq_9.ds__day AS ds__day , subq_9.ds__week AS ds__week , subq_9.ds__month AS ds__month @@ -432,6 +422,16 @@ FROM ( , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_9.metric_time__week AS metric_time__week + , subq_9.metric_time__month AS metric_time__month + , subq_9.metric_time__quarter AS metric_time__quarter + , subq_9.metric_time__year AS metric_time__year + , subq_9.metric_time__extract_year AS metric_time__extract_year + , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_9.metric_time__extract_month AS metric_time__extract_month + , subq_9.metric_time__extract_day AS metric_time__extract_day + , subq_9.metric_time__extract_dow AS metric_time__extract_dow + , subq_9.metric_time__extract_doy AS metric_time__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index 5ebbd2a04..e8324ba7d 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -30,17 +30,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -107,6 +97,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -356,17 +356,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_10.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_10.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_10.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_10.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_10.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_10.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_10.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year , subq_9.ds__day AS ds__day , subq_9.ds__week AS ds__week , subq_9.ds__month AS ds__month @@ -433,6 +423,16 @@ FROM ( , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_9.metric_time__day AS metric_time__day + , subq_9.metric_time__week AS metric_time__week + , subq_9.metric_time__month AS metric_time__month + , subq_9.metric_time__quarter AS metric_time__quarter + , subq_9.metric_time__extract_year AS metric_time__extract_year + , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_9.metric_time__extract_month AS metric_time__extract_month + , subq_9.metric_time__extract_day AS metric_time__extract_day + , subq_9.metric_time__extract_dow AS metric_time__extract_dow + , subq_9.metric_time__extract_doy AS metric_time__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_time_filter__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_time_filter__plan0.sql index 4875a4fc8..f4c919e27 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_time_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_time_filter__plan0.sql @@ -349,16 +349,6 @@ FROM ( -- Constrain Output with WHERE SELECT subq_10.metric_time__day - , subq_10.metric_time__week - , subq_10.metric_time__month - , subq_10.metric_time__quarter - , subq_10.metric_time__year - , subq_10.metric_time__extract_year - , subq_10.metric_time__extract_quarter - , subq_10.metric_time__extract_month - , subq_10.metric_time__extract_day - , subq_10.metric_time__extract_dow - , subq_10.metric_time__extract_doy , subq_10.ds__day , subq_10.ds__week , subq_10.ds__month @@ -425,6 +415,16 @@ FROM ( , subq_10.booking__paid_at__extract_day , subq_10.booking__paid_at__extract_dow , subq_10.booking__paid_at__extract_doy + , subq_10.metric_time__week + , subq_10.metric_time__month + , subq_10.metric_time__quarter + , subq_10.metric_time__year + , subq_10.metric_time__extract_year + , subq_10.metric_time__extract_quarter + , subq_10.metric_time__extract_month + , subq_10.metric_time__extract_day + , subq_10.metric_time__extract_dow + , subq_10.metric_time__extract_doy , subq_10.listing , subq_10.guest , subq_10.host @@ -450,16 +450,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_8.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_8.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_8.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_8.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_8.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_8.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_8.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_8.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_8.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_8.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_8.metric_time__day) AS metric_time__extract_doy , subq_7.ds__day AS ds__day , subq_7.ds__week AS ds__week , subq_7.ds__month AS ds__month @@ -526,6 +516,16 @@ FROM ( , subq_7.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_7.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_7.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_7.metric_time__week AS metric_time__week + , subq_7.metric_time__month AS metric_time__month + , subq_7.metric_time__quarter AS metric_time__quarter + , subq_7.metric_time__year AS metric_time__year + , subq_7.metric_time__extract_year AS metric_time__extract_year + , subq_7.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_7.metric_time__extract_month AS metric_time__extract_month + , 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_7.listing AS listing , subq_7.guest AS guest , subq_7.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0.sql index bd4eb3e83..7a88f67b6 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_5.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_5.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_5.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_5.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_5.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_5.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_5.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_5.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_5.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_5.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_5.metric_time__day) AS 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 @@ -101,6 +91,16 @@ FROM ( , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , 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.guest AS guest , subq_4.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_agg_time_dim__plan0.sql index 774b395b8..8ca19b100 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_agg_time_dim__plan0.sql @@ -31,16 +31,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_2.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_2.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_2.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_2.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_2.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_2.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_2.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_2.booking__ds__day) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_2.booking__ds__day) AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_2.booking__ds__day) AS booking__ds__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -74,6 +64,16 @@ FROM ( , subq_1.paid_at__extract_day AS paid_at__extract_day , subq_1.paid_at__extract_dow AS paid_at__extract_dow , subq_1.paid_at__extract_doy AS paid_at__extract_doy + , subq_1.booking__ds__week AS booking__ds__week + , subq_1.booking__ds__month AS booking__ds__month + , subq_1.booking__ds__quarter AS booking__ds__quarter + , subq_1.booking__ds__year AS booking__ds__year + , subq_1.booking__ds__extract_year AS booking__ds__extract_year + , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_1.booking__ds__extract_month AS booking__ds__extract_month + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0.sql index 31829a75c..ccaa3b6c4 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -101,6 +91,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql index a746fa652..730fca211 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql @@ -57,16 +57,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -133,6 +123,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets__plan0.sql index 890c4e3e7..94457a2be 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets__plan0.sql @@ -41,16 +41,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -117,6 +107,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_time_constraint__plan0.sql index 58d9e97d6..a3777e103 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_time_constraint__plan0.sql @@ -42,16 +42,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -118,6 +108,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_where_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_where_constraint__plan0.sql index 35094f7bb..78c8f98e7 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_where_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_where_constraint__plan0.sql @@ -46,16 +46,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -122,6 +112,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql index ba971f9be..b3388e8d1 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql @@ -26,17 +26,7 @@ FROM ( FROM ( -- Constrain Output with WHERE SELECT - subq_4.metric_time__day - , subq_4.metric_time__week - , subq_4.metric_time__month - , subq_4.metric_time__quarter - , subq_4.metric_time__year - , subq_4.metric_time__extract_year - , subq_4.metric_time__extract_quarter - , subq_4.metric_time__extract_month - , subq_4.metric_time__extract_day - , subq_4.metric_time__extract_dow - , subq_4.metric_time__extract_doy + subq_4.metric_time__month , subq_4.ds__day , subq_4.ds__week , subq_4.ds__month @@ -103,6 +93,16 @@ FROM ( , subq_4.booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy + , subq_4.metric_time__day + , subq_4.metric_time__week + , subq_4.metric_time__quarter + , subq_4.metric_time__year + , subq_4.metric_time__extract_year + , subq_4.metric_time__extract_quarter + , subq_4.metric_time__extract_month + , subq_4.metric_time__extract_day + , subq_4.metric_time__extract_dow + , subq_4.metric_time__extract_doy , subq_4.listing , subq_4.guest , subq_4.host @@ -127,17 +127,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -204,6 +194,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql index a45feb035..6a4dc6cff 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql @@ -19,8 +19,8 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_12.ds AS metric_time__day - , DATE_TRUNC('month', subq_12.ds) AS metric_time__month + DATE_TRUNC('month', subq_12.ds) AS metric_time__month + , subq_10.metric_time__day AS metric_time__day , subq_10.bookings AS bookings FROM ***************************.mf_time_spine subq_12 INNER JOIN ( diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_metric_multiple_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_metric_multiple_granularities__plan0.sql index b0d73d7f0..46a7954ae 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_metric_multiple_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_metric_multiple_granularities__plan0.sql @@ -35,16 +35,8 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -111,6 +103,14 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_with_agg_time_dim__plan0.sql index bfb33d1a6..8c63963df 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_with_agg_time_dim__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_7.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_7.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_7.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_7.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_7.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_7.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_7.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_7.booking__ds__day) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_7.booking__ds__day) AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_7.booking__ds__day) AS booking__ds__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -289,6 +279,16 @@ FROM ( , subq_6.paid_at__extract_day AS paid_at__extract_day , subq_6.paid_at__extract_dow AS paid_at__extract_dow , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , subq_6.booking__ds__week AS booking__ds__week + , subq_6.booking__ds__month AS booking__ds__month + , subq_6.booking__ds__quarter AS booking__ds__quarter + , subq_6.booking__ds__year AS booking__ds__year + , subq_6.booking__ds__extract_year AS booking__ds__extract_year + , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_6.booking__ds__extract_month AS booking__ds__extract_month + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql index e46cb1e76..7572575e6 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql @@ -32,17 +32,7 @@ FROM ( FROM ( -- Constrain Output with WHERE SELECT - subq_4.metric_time__day - , subq_4.metric_time__week - , subq_4.metric_time__month - , subq_4.metric_time__quarter - , subq_4.metric_time__year - , subq_4.metric_time__extract_year - , subq_4.metric_time__extract_quarter - , subq_4.metric_time__extract_month - , subq_4.metric_time__extract_day - , subq_4.metric_time__extract_dow - , subq_4.metric_time__extract_doy + subq_4.metric_time__month , subq_4.ds__day , subq_4.ds__week , subq_4.ds__month @@ -109,6 +99,16 @@ FROM ( , subq_4.booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy + , subq_4.metric_time__day + , subq_4.metric_time__week + , subq_4.metric_time__quarter + , subq_4.metric_time__year + , subq_4.metric_time__extract_year + , subq_4.metric_time__extract_quarter + , subq_4.metric_time__extract_month + , subq_4.metric_time__extract_day + , subq_4.metric_time__extract_dow + , subq_4.metric_time__extract_doy , subq_4.listing , subq_4.guest , subq_4.host @@ -133,17 +133,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -210,6 +200,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql index 0acbd8cac..64709ee44 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql @@ -25,8 +25,8 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_19.ds AS metric_time__day - , DATE_TRUNC('month', subq_19.ds) AS metric_time__month + DATE_TRUNC('month', subq_19.ds) AS metric_time__month + , DATE_TRUNC('day', bookings_source_src_28000.ds) AS metric_time__day , bookings_source_src_28000.booking_value AS booking_value FROM ***************************.mf_time_spine subq_19 INNER JOIN diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_metric_multiple_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_metric_multiple_granularities__plan0.sql index 9013788a3..3977f5cb7 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_metric_multiple_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_metric_multiple_granularities__plan0.sql @@ -43,16 +43,8 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -119,6 +111,14 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_agg_time_dim__plan0.sql index e195e45c3..b8b961e7b 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_agg_time_dim__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_7.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_7.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_7.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_7.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_7.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_7.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_7.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_7.booking__ds__day) AS booking__ds__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_7.booking__ds__day) AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_7.booking__ds__day) AS booking__ds__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -289,6 +279,16 @@ FROM ( , subq_6.paid_at__extract_day AS paid_at__extract_day , subq_6.paid_at__extract_dow AS paid_at__extract_dow , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , subq_6.booking__ds__week AS booking__ds__week + , subq_6.booking__ds__month AS booking__ds__month + , subq_6.booking__ds__quarter AS booking__ds__quarter + , subq_6.booking__ds__year AS booking__ds__year + , subq_6.booking__ds__extract_year AS booking__ds__extract_year + , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_6.booking__ds__extract_month AS booking__ds__extract_month + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_time_offset_metric_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_time_offset_metric_with_time_constraint__plan0.sql index 657dc7ed6..5176f8516 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_time_offset_metric_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_time_offset_metric_with_time_constraint__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -101,6 +91,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql index 8687b2958..86d1fbeba 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Constrain Time Range to [2019-12-19T00:00:00, 2020-01-02T00:00:00] SELECT subq_7.metric_time__day - , subq_7.metric_time__week - , subq_7.metric_time__month - , subq_7.metric_time__quarter - , subq_7.metric_time__year - , subq_7.metric_time__extract_year - , subq_7.metric_time__extract_quarter - , subq_7.metric_time__extract_month - , subq_7.metric_time__extract_day - , subq_7.metric_time__extract_dow - , subq_7.metric_time__extract_doy , subq_7.ds__day , subq_7.ds__week , subq_7.ds__month @@ -101,6 +91,16 @@ FROM ( , subq_7.booking__paid_at__extract_day , subq_7.booking__paid_at__extract_dow , subq_7.booking__paid_at__extract_doy + , subq_7.metric_time__week + , subq_7.metric_time__month + , subq_7.metric_time__quarter + , subq_7.metric_time__year + , subq_7.metric_time__extract_year + , subq_7.metric_time__extract_quarter + , subq_7.metric_time__extract_month + , subq_7.metric_time__extract_day + , subq_7.metric_time__extract_dow + , subq_7.metric_time__extract_doy , subq_7.listing , subq_7.guest , subq_7.host @@ -126,16 +126,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_5.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_5.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_5.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_5.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_5.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_5.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_5.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_5.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_5.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_5.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_5.metric_time__day) AS 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 @@ -202,6 +192,16 @@ FROM ( , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , 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.guest AS guest , subq_4.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql index 497c4012f..ccb81c2d5 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql @@ -25,11 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__month AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__month) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__month) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__month) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__month) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__month) AS metric_time__extract_month , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year @@ -42,6 +37,11 @@ FROM ( , subq_1.booking_monthly__ds__extract_year AS booking_monthly__ds__extract_year , subq_1.booking_monthly__ds__extract_quarter AS booking_monthly__ds__extract_quarter , subq_1.booking_monthly__ds__extract_month AS booking_monthly__ds__extract_month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month , subq_1.listing AS listing , subq_1.booking_monthly__listing AS booking_monthly__listing , subq_1.bookings_monthly AS bookings_monthly diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0.sql index c4fbb6884..965a3e413 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index b933e3ea1..b4bb83a6a 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -245,17 +245,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__day AS metric_time__day + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0.sql index 3d18c9153..e5c8285f3 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0.sql index 1313b8af5..35df55b84 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -245,17 +245,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__day AS metric_time__day + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index 9d7beef87..f2414d159 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -31,16 +31,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -107,6 +97,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -356,16 +356,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_10.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_10.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_10.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_10.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_10.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_10.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_10.metric_time__day) AS metric_time__extract_doy , subq_9.ds__day AS ds__day , subq_9.ds__week AS ds__week , subq_9.ds__month AS ds__month @@ -432,6 +422,16 @@ FROM ( , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_9.metric_time__week AS metric_time__week + , subq_9.metric_time__month AS metric_time__month + , subq_9.metric_time__quarter AS metric_time__quarter + , subq_9.metric_time__year AS metric_time__year + , subq_9.metric_time__extract_year AS metric_time__extract_year + , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_9.metric_time__extract_month AS metric_time__extract_month + , subq_9.metric_time__extract_day AS metric_time__extract_day + , subq_9.metric_time__extract_dow AS metric_time__extract_dow + , subq_9.metric_time__extract_doy AS metric_time__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index 30f9d6cef..1205c6d9f 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -30,17 +30,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -107,6 +97,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -356,17 +356,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_10.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_10.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_10.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_10.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_10.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_10.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_10.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year , subq_9.ds__day AS ds__day , subq_9.ds__week AS ds__week , subq_9.ds__month AS ds__month @@ -433,6 +423,16 @@ FROM ( , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_9.metric_time__day AS metric_time__day + , subq_9.metric_time__week AS metric_time__week + , subq_9.metric_time__month AS metric_time__month + , subq_9.metric_time__quarter AS metric_time__quarter + , subq_9.metric_time__extract_year AS metric_time__extract_year + , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_9.metric_time__extract_month AS metric_time__extract_month + , subq_9.metric_time__extract_day AS metric_time__extract_day + , subq_9.metric_time__extract_dow AS metric_time__extract_dow + , subq_9.metric_time__extract_doy AS metric_time__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_time_filter__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_time_filter__plan0.sql index e18ced63c..7fc8e48bd 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_time_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_time_filter__plan0.sql @@ -349,16 +349,6 @@ FROM ( -- Constrain Output with WHERE SELECT subq_10.metric_time__day - , subq_10.metric_time__week - , subq_10.metric_time__month - , subq_10.metric_time__quarter - , subq_10.metric_time__year - , subq_10.metric_time__extract_year - , subq_10.metric_time__extract_quarter - , subq_10.metric_time__extract_month - , subq_10.metric_time__extract_day - , subq_10.metric_time__extract_dow - , subq_10.metric_time__extract_doy , subq_10.ds__day , subq_10.ds__week , subq_10.ds__month @@ -425,6 +415,16 @@ FROM ( , subq_10.booking__paid_at__extract_day , subq_10.booking__paid_at__extract_dow , subq_10.booking__paid_at__extract_doy + , subq_10.metric_time__week + , subq_10.metric_time__month + , subq_10.metric_time__quarter + , subq_10.metric_time__year + , subq_10.metric_time__extract_year + , subq_10.metric_time__extract_quarter + , subq_10.metric_time__extract_month + , subq_10.metric_time__extract_day + , subq_10.metric_time__extract_dow + , subq_10.metric_time__extract_doy , subq_10.listing , subq_10.guest , subq_10.host @@ -450,16 +450,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_8.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_8.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_8.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_8.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_8.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_8.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_8.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_8.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_8.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_8.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_8.metric_time__day) AS metric_time__extract_doy , subq_7.ds__day AS ds__day , subq_7.ds__week AS ds__week , subq_7.ds__month AS ds__month @@ -526,6 +516,16 @@ FROM ( , subq_7.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_7.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_7.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_7.metric_time__week AS metric_time__week + , subq_7.metric_time__month AS metric_time__month + , subq_7.metric_time__quarter AS metric_time__quarter + , subq_7.metric_time__year AS metric_time__year + , subq_7.metric_time__extract_year AS metric_time__extract_year + , subq_7.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_7.metric_time__extract_month AS metric_time__extract_month + , 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_7.listing AS listing , subq_7.guest AS guest , subq_7.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0.sql index 86e90bb38..fc3297f5e 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_5.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_5.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_5.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_5.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_5.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_5.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_5.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_5.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_5.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_5.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_5.metric_time__day) AS 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 @@ -101,6 +91,16 @@ FROM ( , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , 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.guest AS guest , subq_4.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_agg_time_dim__plan0.sql index 60eac90fe..a92488400 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_agg_time_dim__plan0.sql @@ -31,16 +31,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_2.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_2.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_2.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_2.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_2.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_2.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_2.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_2.booking__ds__day) AS booking__ds__extract_day - , EXTRACT(isodow FROM subq_2.booking__ds__day) AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_2.booking__ds__day) AS booking__ds__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -74,6 +64,16 @@ FROM ( , subq_1.paid_at__extract_day AS paid_at__extract_day , subq_1.paid_at__extract_dow AS paid_at__extract_dow , subq_1.paid_at__extract_doy AS paid_at__extract_doy + , subq_1.booking__ds__week AS booking__ds__week + , subq_1.booking__ds__month AS booking__ds__month + , subq_1.booking__ds__quarter AS booking__ds__quarter + , subq_1.booking__ds__year AS booking__ds__year + , subq_1.booking__ds__extract_year AS booking__ds__extract_year + , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_1.booking__ds__extract_month AS booking__ds__extract_month + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0.sql index 3ab9a2558..289baf57e 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -101,6 +91,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql index a2c06603c..02e47d507 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql @@ -57,16 +57,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -133,6 +123,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets__plan0.sql index a851e43a3..5579580ac 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets__plan0.sql @@ -41,16 +41,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -117,6 +107,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_time_constraint__plan0.sql index ddd6e6235..e00e75288 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_time_constraint__plan0.sql @@ -42,16 +42,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -118,6 +108,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_where_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_where_constraint__plan0.sql index b104ae2cb..6faf69f0f 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_where_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_where_constraint__plan0.sql @@ -46,16 +46,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -122,6 +112,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql index 72b5a8eff..31d1d67ba 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql @@ -26,17 +26,7 @@ FROM ( FROM ( -- Constrain Output with WHERE SELECT - subq_4.metric_time__day - , subq_4.metric_time__week - , subq_4.metric_time__month - , subq_4.metric_time__quarter - , subq_4.metric_time__year - , subq_4.metric_time__extract_year - , subq_4.metric_time__extract_quarter - , subq_4.metric_time__extract_month - , subq_4.metric_time__extract_day - , subq_4.metric_time__extract_dow - , subq_4.metric_time__extract_doy + subq_4.metric_time__month , subq_4.ds__day , subq_4.ds__week , subq_4.ds__month @@ -103,6 +93,16 @@ FROM ( , subq_4.booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy + , subq_4.metric_time__day + , subq_4.metric_time__week + , subq_4.metric_time__quarter + , subq_4.metric_time__year + , subq_4.metric_time__extract_year + , subq_4.metric_time__extract_quarter + , subq_4.metric_time__extract_month + , subq_4.metric_time__extract_day + , subq_4.metric_time__extract_dow + , subq_4.metric_time__extract_doy , subq_4.listing , subq_4.guest , subq_4.host @@ -127,17 +127,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -204,6 +194,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql index 29518080d..f380958df 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql @@ -19,8 +19,8 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_12.ds AS metric_time__day - , DATE_TRUNC('month', subq_12.ds) AS metric_time__month + DATE_TRUNC('month', subq_12.ds) AS metric_time__month + , subq_10.metric_time__day AS metric_time__day , subq_10.bookings AS bookings FROM ***************************.mf_time_spine subq_12 INNER JOIN ( diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_metric_multiple_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_metric_multiple_granularities__plan0.sql index 5444675ba..6f53b5c5f 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_metric_multiple_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_metric_multiple_granularities__plan0.sql @@ -35,16 +35,8 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -111,6 +103,14 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_with_agg_time_dim__plan0.sql index fb482efc7..0c6691fa2 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_with_agg_time_dim__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_7.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_7.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_7.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_7.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_7.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_7.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_7.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_7.booking__ds__day) AS booking__ds__extract_day - , EXTRACT(isodow FROM subq_7.booking__ds__day) AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_7.booking__ds__day) AS booking__ds__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -289,6 +279,16 @@ FROM ( , subq_6.paid_at__extract_day AS paid_at__extract_day , subq_6.paid_at__extract_dow AS paid_at__extract_dow , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , subq_6.booking__ds__week AS booking__ds__week + , subq_6.booking__ds__month AS booking__ds__month + , subq_6.booking__ds__quarter AS booking__ds__quarter + , subq_6.booking__ds__year AS booking__ds__year + , subq_6.booking__ds__extract_year AS booking__ds__extract_year + , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_6.booking__ds__extract_month AS booking__ds__extract_month + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql index 927127c08..e6cdd5a26 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql @@ -32,17 +32,7 @@ FROM ( FROM ( -- Constrain Output with WHERE SELECT - subq_4.metric_time__day - , subq_4.metric_time__week - , subq_4.metric_time__month - , subq_4.metric_time__quarter - , subq_4.metric_time__year - , subq_4.metric_time__extract_year - , subq_4.metric_time__extract_quarter - , subq_4.metric_time__extract_month - , subq_4.metric_time__extract_day - , subq_4.metric_time__extract_dow - , subq_4.metric_time__extract_doy + subq_4.metric_time__month , subq_4.ds__day , subq_4.ds__week , subq_4.ds__month @@ -109,6 +99,16 @@ FROM ( , subq_4.booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy + , subq_4.metric_time__day + , subq_4.metric_time__week + , subq_4.metric_time__quarter + , subq_4.metric_time__year + , subq_4.metric_time__extract_year + , subq_4.metric_time__extract_quarter + , subq_4.metric_time__extract_month + , subq_4.metric_time__extract_day + , subq_4.metric_time__extract_dow + , subq_4.metric_time__extract_doy , subq_4.listing , subq_4.guest , subq_4.host @@ -133,17 +133,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -210,6 +200,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql index 63f543a97..84cf6afb8 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql @@ -25,8 +25,8 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_19.ds AS metric_time__day - , DATE_TRUNC('month', subq_19.ds) AS metric_time__month + DATE_TRUNC('month', subq_19.ds) AS metric_time__month + , DATE_TRUNC('day', bookings_source_src_28000.ds) AS metric_time__day , bookings_source_src_28000.booking_value AS booking_value FROM ***************************.mf_time_spine subq_19 INNER JOIN diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_metric_multiple_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_metric_multiple_granularities__plan0.sql index ffb393b1f..901aaba69 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_metric_multiple_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_metric_multiple_granularities__plan0.sql @@ -43,16 +43,8 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -119,6 +111,14 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_agg_time_dim__plan0.sql index de2bbaadc..975bcd964 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_agg_time_dim__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_7.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_7.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_7.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_7.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_7.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_7.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_7.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_7.booking__ds__day) AS booking__ds__extract_day - , EXTRACT(isodow FROM subq_7.booking__ds__day) AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_7.booking__ds__day) AS booking__ds__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -289,6 +279,16 @@ FROM ( , subq_6.paid_at__extract_day AS paid_at__extract_day , subq_6.paid_at__extract_dow AS paid_at__extract_dow , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , subq_6.booking__ds__week AS booking__ds__week + , subq_6.booking__ds__month AS booking__ds__month + , subq_6.booking__ds__quarter AS booking__ds__quarter + , subq_6.booking__ds__year AS booking__ds__year + , subq_6.booking__ds__extract_year AS booking__ds__extract_year + , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_6.booking__ds__extract_month AS booking__ds__extract_month + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_time_offset_metric_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_time_offset_metric_with_time_constraint__plan0.sql index 73f42bbf8..623f3e186 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_time_offset_metric_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_time_offset_metric_with_time_constraint__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -101,6 +91,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql index 0927844d4..e7a776d64 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Constrain Time Range to [2019-12-19T00:00:00, 2020-01-02T00:00:00] SELECT subq_7.metric_time__day - , subq_7.metric_time__week - , subq_7.metric_time__month - , subq_7.metric_time__quarter - , subq_7.metric_time__year - , subq_7.metric_time__extract_year - , subq_7.metric_time__extract_quarter - , subq_7.metric_time__extract_month - , subq_7.metric_time__extract_day - , subq_7.metric_time__extract_dow - , subq_7.metric_time__extract_doy , subq_7.ds__day , subq_7.ds__week , subq_7.ds__month @@ -101,6 +91,16 @@ FROM ( , subq_7.booking__paid_at__extract_day , subq_7.booking__paid_at__extract_dow , subq_7.booking__paid_at__extract_doy + , subq_7.metric_time__week + , subq_7.metric_time__month + , subq_7.metric_time__quarter + , subq_7.metric_time__year + , subq_7.metric_time__extract_year + , subq_7.metric_time__extract_quarter + , subq_7.metric_time__extract_month + , subq_7.metric_time__extract_day + , subq_7.metric_time__extract_dow + , subq_7.metric_time__extract_doy , subq_7.listing , subq_7.guest , subq_7.host @@ -126,16 +126,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_5.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_5.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_5.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_5.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_5.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_5.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_5.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_5.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_5.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_5.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_5.metric_time__day) AS 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 @@ -202,6 +192,16 @@ FROM ( , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , 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.guest AS guest , subq_4.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql index 4518dcda4..93ebb3135 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql @@ -25,11 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__month AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__month) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__month) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__month) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__month) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__month) AS metric_time__extract_month , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year @@ -42,6 +37,11 @@ FROM ( , subq_1.booking_monthly__ds__extract_year AS booking_monthly__ds__extract_year , subq_1.booking_monthly__ds__extract_quarter AS booking_monthly__ds__extract_quarter , subq_1.booking_monthly__ds__extract_month AS booking_monthly__ds__extract_month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month , subq_1.listing AS listing , subq_1.booking_monthly__listing AS booking_monthly__listing , subq_1.bookings_monthly AS bookings_monthly diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0.sql index 18a8bd89f..e25a0010f 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index 2fe28b5f2..2111c8945 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -245,17 +245,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__day AS metric_time__day + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0.sql index 95cc95943..2d15542c6 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0.sql index 97dbca903..2344dcc31 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -245,17 +245,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__day AS metric_time__day + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index 6f643295f..7ae1d2eb4 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -31,16 +31,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -107,6 +97,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -356,16 +356,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_10.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_10.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_10.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_10.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_10.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_10.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_10.metric_time__day) AS metric_time__extract_doy , subq_9.ds__day AS ds__day , subq_9.ds__week AS ds__week , subq_9.ds__month AS ds__month @@ -432,6 +422,16 @@ FROM ( , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_9.metric_time__week AS metric_time__week + , subq_9.metric_time__month AS metric_time__month + , subq_9.metric_time__quarter AS metric_time__quarter + , subq_9.metric_time__year AS metric_time__year + , subq_9.metric_time__extract_year AS metric_time__extract_year + , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_9.metric_time__extract_month AS metric_time__extract_month + , subq_9.metric_time__extract_day AS metric_time__extract_day + , subq_9.metric_time__extract_dow AS metric_time__extract_dow + , subq_9.metric_time__extract_doy AS metric_time__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index 2d25e0810..9a4536780 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -30,17 +30,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -107,6 +97,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -356,17 +356,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_10.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_10.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_10.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_10.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_10.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_10.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_10.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year , subq_9.ds__day AS ds__day , subq_9.ds__week AS ds__week , subq_9.ds__month AS ds__month @@ -433,6 +423,16 @@ FROM ( , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_9.metric_time__day AS metric_time__day + , subq_9.metric_time__week AS metric_time__week + , subq_9.metric_time__month AS metric_time__month + , subq_9.metric_time__quarter AS metric_time__quarter + , subq_9.metric_time__extract_year AS metric_time__extract_year + , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_9.metric_time__extract_month AS metric_time__extract_month + , subq_9.metric_time__extract_day AS metric_time__extract_day + , subq_9.metric_time__extract_dow AS metric_time__extract_dow + , subq_9.metric_time__extract_doy AS metric_time__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_time_filter__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_time_filter__plan0.sql index d81a0bd29..4f7ecf502 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_time_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_time_filter__plan0.sql @@ -349,16 +349,6 @@ FROM ( -- Constrain Output with WHERE SELECT subq_10.metric_time__day - , subq_10.metric_time__week - , subq_10.metric_time__month - , subq_10.metric_time__quarter - , subq_10.metric_time__year - , subq_10.metric_time__extract_year - , subq_10.metric_time__extract_quarter - , subq_10.metric_time__extract_month - , subq_10.metric_time__extract_day - , subq_10.metric_time__extract_dow - , subq_10.metric_time__extract_doy , subq_10.ds__day , subq_10.ds__week , subq_10.ds__month @@ -425,6 +415,16 @@ FROM ( , subq_10.booking__paid_at__extract_day , subq_10.booking__paid_at__extract_dow , subq_10.booking__paid_at__extract_doy + , subq_10.metric_time__week + , subq_10.metric_time__month + , subq_10.metric_time__quarter + , subq_10.metric_time__year + , subq_10.metric_time__extract_year + , subq_10.metric_time__extract_quarter + , subq_10.metric_time__extract_month + , subq_10.metric_time__extract_day + , subq_10.metric_time__extract_dow + , subq_10.metric_time__extract_doy , subq_10.listing , subq_10.guest , subq_10.host @@ -450,16 +450,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_8.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_8.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_8.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_8.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_8.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_8.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_8.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_8.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_8.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_8.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_8.metric_time__day) AS metric_time__extract_doy , subq_7.ds__day AS ds__day , subq_7.ds__week AS ds__week , subq_7.ds__month AS ds__month @@ -526,6 +516,16 @@ FROM ( , subq_7.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_7.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_7.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_7.metric_time__week AS metric_time__week + , subq_7.metric_time__month AS metric_time__month + , subq_7.metric_time__quarter AS metric_time__quarter + , subq_7.metric_time__year AS metric_time__year + , subq_7.metric_time__extract_year AS metric_time__extract_year + , subq_7.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_7.metric_time__extract_month AS metric_time__extract_month + , 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_7.listing AS listing , subq_7.guest AS guest , subq_7.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0.sql index 1bb65d4bd..eea894032 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_5.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_5.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_5.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_5.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_5.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_5.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_5.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_5.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_5.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_5.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_5.metric_time__day) AS 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 @@ -101,6 +91,16 @@ FROM ( , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , 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.guest AS guest , subq_4.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_agg_time_dim__plan0.sql index 064da1e7d..a07f9018a 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_agg_time_dim__plan0.sql @@ -31,16 +31,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_2.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_2.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_2.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_2.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_2.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_2.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_2.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_2.booking__ds__day) AS booking__ds__extract_day - , EXTRACT(isodow FROM subq_2.booking__ds__day) AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_2.booking__ds__day) AS booking__ds__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -74,6 +64,16 @@ FROM ( , subq_1.paid_at__extract_day AS paid_at__extract_day , subq_1.paid_at__extract_dow AS paid_at__extract_dow , subq_1.paid_at__extract_doy AS paid_at__extract_doy + , subq_1.booking__ds__week AS booking__ds__week + , subq_1.booking__ds__month AS booking__ds__month + , subq_1.booking__ds__quarter AS booking__ds__quarter + , subq_1.booking__ds__year AS booking__ds__year + , subq_1.booking__ds__extract_year AS booking__ds__extract_year + , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_1.booking__ds__extract_month AS booking__ds__extract_month + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0.sql index 9213168ed..22f7060c2 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -101,6 +91,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql index f30a7ea83..221f93ec2 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql @@ -57,16 +57,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -133,6 +123,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets__plan0.sql index 52b31be08..36df5e99e 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets__plan0.sql @@ -41,16 +41,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -117,6 +107,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_time_constraint__plan0.sql index 13a96edff..f75ae7237 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_time_constraint__plan0.sql @@ -42,16 +42,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -118,6 +108,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_where_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_where_constraint__plan0.sql index 751d21034..7b4679dfb 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_where_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_where_constraint__plan0.sql @@ -46,16 +46,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -122,6 +112,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql index 89596a1ed..b88fd360e 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql @@ -26,17 +26,7 @@ FROM ( FROM ( -- Constrain Output with WHERE SELECT - subq_4.metric_time__day - , subq_4.metric_time__week - , subq_4.metric_time__month - , subq_4.metric_time__quarter - , subq_4.metric_time__year - , subq_4.metric_time__extract_year - , subq_4.metric_time__extract_quarter - , subq_4.metric_time__extract_month - , subq_4.metric_time__extract_day - , subq_4.metric_time__extract_dow - , subq_4.metric_time__extract_doy + subq_4.metric_time__month , subq_4.ds__day , subq_4.ds__week , subq_4.ds__month @@ -103,6 +93,16 @@ FROM ( , subq_4.booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy + , subq_4.metric_time__day + , subq_4.metric_time__week + , subq_4.metric_time__quarter + , subq_4.metric_time__year + , subq_4.metric_time__extract_year + , subq_4.metric_time__extract_quarter + , subq_4.metric_time__extract_month + , subq_4.metric_time__extract_day + , subq_4.metric_time__extract_dow + , subq_4.metric_time__extract_doy , subq_4.listing , subq_4.guest , subq_4.host @@ -127,17 +127,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -204,6 +194,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql index 52f737090..1a409e33f 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql @@ -19,8 +19,8 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_12.ds AS metric_time__day - , DATE_TRUNC('month', subq_12.ds) AS metric_time__month + DATE_TRUNC('month', subq_12.ds) AS metric_time__month + , subq_10.metric_time__day AS metric_time__day , subq_10.bookings AS bookings FROM ***************************.mf_time_spine subq_12 INNER JOIN ( diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_metric_multiple_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_metric_multiple_granularities__plan0.sql index 4e7a675cb..0c783016e 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_metric_multiple_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_metric_multiple_granularities__plan0.sql @@ -35,16 +35,8 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -111,6 +103,14 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_with_agg_time_dim__plan0.sql index 653805878..d5393a5ab 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_with_agg_time_dim__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_7.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_7.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_7.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_7.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_7.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_7.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_7.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_7.booking__ds__day) AS booking__ds__extract_day - , EXTRACT(isodow FROM subq_7.booking__ds__day) AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_7.booking__ds__day) AS booking__ds__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -289,6 +279,16 @@ FROM ( , subq_6.paid_at__extract_day AS paid_at__extract_day , subq_6.paid_at__extract_dow AS paid_at__extract_dow , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , subq_6.booking__ds__week AS booking__ds__week + , subq_6.booking__ds__month AS booking__ds__month + , subq_6.booking__ds__quarter AS booking__ds__quarter + , subq_6.booking__ds__year AS booking__ds__year + , subq_6.booking__ds__extract_year AS booking__ds__extract_year + , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_6.booking__ds__extract_month AS booking__ds__extract_month + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql index 52d416485..3209ff95a 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql @@ -32,17 +32,7 @@ FROM ( FROM ( -- Constrain Output with WHERE SELECT - subq_4.metric_time__day - , subq_4.metric_time__week - , subq_4.metric_time__month - , subq_4.metric_time__quarter - , subq_4.metric_time__year - , subq_4.metric_time__extract_year - , subq_4.metric_time__extract_quarter - , subq_4.metric_time__extract_month - , subq_4.metric_time__extract_day - , subq_4.metric_time__extract_dow - , subq_4.metric_time__extract_doy + subq_4.metric_time__month , subq_4.ds__day , subq_4.ds__week , subq_4.ds__month @@ -109,6 +99,16 @@ FROM ( , subq_4.booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy + , subq_4.metric_time__day + , subq_4.metric_time__week + , subq_4.metric_time__quarter + , subq_4.metric_time__year + , subq_4.metric_time__extract_year + , subq_4.metric_time__extract_quarter + , subq_4.metric_time__extract_month + , subq_4.metric_time__extract_day + , subq_4.metric_time__extract_dow + , subq_4.metric_time__extract_doy , subq_4.listing , subq_4.guest , subq_4.host @@ -133,17 +133,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -210,6 +200,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql index 3934f7c7b..854b6cf02 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql @@ -25,8 +25,8 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_19.ds AS metric_time__day - , DATE_TRUNC('month', subq_19.ds) AS metric_time__month + DATE_TRUNC('month', subq_19.ds) AS metric_time__month + , DATE_TRUNC('day', bookings_source_src_28000.ds) AS metric_time__day , bookings_source_src_28000.booking_value AS booking_value FROM ***************************.mf_time_spine subq_19 INNER JOIN diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_metric_multiple_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_metric_multiple_granularities__plan0.sql index 71b40a688..c9c7b82cc 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_metric_multiple_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_metric_multiple_granularities__plan0.sql @@ -43,16 +43,8 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -119,6 +111,14 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_agg_time_dim__plan0.sql index 9bfdb6ef0..4197aa4fe 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_agg_time_dim__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_7.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_7.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_7.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_7.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_7.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_7.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_7.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_7.booking__ds__day) AS booking__ds__extract_day - , EXTRACT(isodow FROM subq_7.booking__ds__day) AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_7.booking__ds__day) AS booking__ds__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -289,6 +279,16 @@ FROM ( , subq_6.paid_at__extract_day AS paid_at__extract_day , subq_6.paid_at__extract_dow AS paid_at__extract_dow , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , subq_6.booking__ds__week AS booking__ds__week + , subq_6.booking__ds__month AS booking__ds__month + , subq_6.booking__ds__quarter AS booking__ds__quarter + , subq_6.booking__ds__year AS booking__ds__year + , subq_6.booking__ds__extract_year AS booking__ds__extract_year + , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_6.booking__ds__extract_month AS booking__ds__extract_month + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_time_offset_metric_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_time_offset_metric_with_time_constraint__plan0.sql index b2bad3461..975d7267b 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_time_offset_metric_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_time_offset_metric_with_time_constraint__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -101,6 +91,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql index 0b9759219..105d5d477 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Constrain Time Range to [2019-12-19T00:00:00, 2020-01-02T00:00:00] SELECT subq_7.metric_time__day - , subq_7.metric_time__week - , subq_7.metric_time__month - , subq_7.metric_time__quarter - , subq_7.metric_time__year - , subq_7.metric_time__extract_year - , subq_7.metric_time__extract_quarter - , subq_7.metric_time__extract_month - , subq_7.metric_time__extract_day - , subq_7.metric_time__extract_dow - , subq_7.metric_time__extract_doy , subq_7.ds__day , subq_7.ds__week , subq_7.ds__month @@ -101,6 +91,16 @@ FROM ( , subq_7.booking__paid_at__extract_day , subq_7.booking__paid_at__extract_dow , subq_7.booking__paid_at__extract_doy + , subq_7.metric_time__week + , subq_7.metric_time__month + , subq_7.metric_time__quarter + , subq_7.metric_time__year + , subq_7.metric_time__extract_year + , subq_7.metric_time__extract_quarter + , subq_7.metric_time__extract_month + , subq_7.metric_time__extract_day + , subq_7.metric_time__extract_dow + , subq_7.metric_time__extract_doy , subq_7.listing , subq_7.guest , subq_7.host @@ -126,16 +126,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_5.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_5.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_5.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_5.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_5.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_5.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_5.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_5.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_5.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_5.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_5.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_5.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_5.metric_time__day) AS 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 @@ -202,6 +192,16 @@ FROM ( , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , 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.guest AS guest , subq_4.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql index a3eb7774e..783d28a0b 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql @@ -25,11 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__month AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__month) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__month) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__month) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__month) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__month) AS metric_time__extract_month , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year @@ -42,6 +37,11 @@ FROM ( , subq_1.booking_monthly__ds__extract_year AS booking_monthly__ds__extract_year , subq_1.booking_monthly__ds__extract_quarter AS booking_monthly__ds__extract_quarter , subq_1.booking_monthly__ds__extract_month AS booking_monthly__ds__extract_month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month , subq_1.listing AS listing , subq_1.booking_monthly__listing AS booking_monthly__listing , subq_1.bookings_monthly AS bookings_monthly diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0.sql index f4a2fed1f..812538acb 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_7.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_7.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_7.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index cf24407aa..05fd6da80 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -245,17 +245,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_7.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_7.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_7.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__day AS metric_time__day + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0.sql index 2a433514d..7461ededc 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_7.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_7.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_7.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0.sql index 07697b3a4..75f35eb71 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -245,17 +245,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_7.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_7.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_7.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__day AS metric_time__day + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index 2a31dc99d..ab2724a63 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -31,16 +31,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_2.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_2.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_2.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -107,6 +97,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -356,16 +356,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_10.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_10.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_10.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_10.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_10.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_10.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_10.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_10.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_10.metric_time__day) AS metric_time__extract_doy , subq_9.ds__day AS ds__day , subq_9.ds__week AS ds__week , subq_9.ds__month AS ds__month @@ -432,6 +422,16 @@ FROM ( , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_9.metric_time__week AS metric_time__week + , subq_9.metric_time__month AS metric_time__month + , subq_9.metric_time__quarter AS metric_time__quarter + , subq_9.metric_time__year AS metric_time__year + , subq_9.metric_time__extract_year AS metric_time__extract_year + , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_9.metric_time__extract_month AS metric_time__extract_month + , subq_9.metric_time__extract_day AS metric_time__extract_day + , subq_9.metric_time__extract_dow AS metric_time__extract_dow + , subq_9.metric_time__extract_doy AS metric_time__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index 4b7f458d9..ee07090c3 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -30,17 +30,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_2.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_2.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_2.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -107,6 +97,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -356,17 +356,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_10.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_10.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_10.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_10.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_10.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_10.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_10.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_10.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_10.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year , subq_9.ds__day AS ds__day , subq_9.ds__week AS ds__week , subq_9.ds__month AS ds__month @@ -433,6 +423,16 @@ FROM ( , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_9.metric_time__day AS metric_time__day + , subq_9.metric_time__week AS metric_time__week + , subq_9.metric_time__month AS metric_time__month + , subq_9.metric_time__quarter AS metric_time__quarter + , subq_9.metric_time__extract_year AS metric_time__extract_year + , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_9.metric_time__extract_month AS metric_time__extract_month + , subq_9.metric_time__extract_day AS metric_time__extract_day + , subq_9.metric_time__extract_dow AS metric_time__extract_dow + , subq_9.metric_time__extract_doy AS metric_time__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_time_filter__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_time_filter__plan0.sql index b77fdf6bf..f020af8c9 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_time_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_time_filter__plan0.sql @@ -349,16 +349,6 @@ FROM ( -- Constrain Output with WHERE SELECT subq_10.metric_time__day - , subq_10.metric_time__week - , subq_10.metric_time__month - , subq_10.metric_time__quarter - , subq_10.metric_time__year - , subq_10.metric_time__extract_year - , subq_10.metric_time__extract_quarter - , subq_10.metric_time__extract_month - , subq_10.metric_time__extract_day - , subq_10.metric_time__extract_dow - , subq_10.metric_time__extract_doy , subq_10.ds__day , subq_10.ds__week , subq_10.ds__month @@ -425,6 +415,16 @@ FROM ( , subq_10.booking__paid_at__extract_day , subq_10.booking__paid_at__extract_dow , subq_10.booking__paid_at__extract_doy + , subq_10.metric_time__week + , subq_10.metric_time__month + , subq_10.metric_time__quarter + , subq_10.metric_time__year + , subq_10.metric_time__extract_year + , subq_10.metric_time__extract_quarter + , subq_10.metric_time__extract_month + , subq_10.metric_time__extract_day + , subq_10.metric_time__extract_dow + , subq_10.metric_time__extract_doy , subq_10.listing , subq_10.guest , subq_10.host @@ -450,16 +450,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_8.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_8.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_8.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_8.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_8.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_8.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_8.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_8.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_8.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_8.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_8.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_8.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_8.metric_time__day) AS metric_time__extract_doy , subq_7.ds__day AS ds__day , subq_7.ds__week AS ds__week , subq_7.ds__month AS ds__month @@ -526,6 +516,16 @@ FROM ( , subq_7.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_7.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_7.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_7.metric_time__week AS metric_time__week + , subq_7.metric_time__month AS metric_time__month + , subq_7.metric_time__quarter AS metric_time__quarter + , subq_7.metric_time__year AS metric_time__year + , subq_7.metric_time__extract_year AS metric_time__extract_year + , subq_7.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_7.metric_time__extract_month AS metric_time__extract_month + , 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_7.listing AS listing , subq_7.guest AS guest , subq_7.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_cumulative_metric__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_cumulative_metric__plan0.sql index 9c63f2ec3..aa66a538c 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_cumulative_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_cumulative_metric__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_5.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_5.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_5.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_5.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_5.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_5.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_5.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_5.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_5.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_5.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_5.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_5.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_5.metric_time__day) AS 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 @@ -101,6 +91,16 @@ FROM ( , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , 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.guest AS guest , subq_4.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_agg_time_dim__plan0.sql index 021ac16d7..df2faa021 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_agg_time_dim__plan0.sql @@ -31,16 +31,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_2.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_2.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_2.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_2.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_2.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_2.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_2.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_2.booking__ds__day) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM subq_2.booking__ds__day) = 0 THEN EXTRACT(dow FROM subq_2.booking__ds__day) + 7 ELSE EXTRACT(dow FROM subq_2.booking__ds__day) END AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_2.booking__ds__day) AS booking__ds__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -74,6 +64,16 @@ FROM ( , subq_1.paid_at__extract_day AS paid_at__extract_day , subq_1.paid_at__extract_dow AS paid_at__extract_dow , subq_1.paid_at__extract_doy AS paid_at__extract_doy + , subq_1.booking__ds__week AS booking__ds__week + , subq_1.booking__ds__month AS booking__ds__month + , subq_1.booking__ds__quarter AS booking__ds__quarter + , subq_1.booking__ds__year AS booking__ds__year + , subq_1.booking__ds__extract_year AS booking__ds__extract_year + , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_1.booking__ds__extract_month AS booking__ds__extract_month + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_one_input_metric__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_one_input_metric__plan0.sql index 4c35c5327..992f40492 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_2.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_2.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_2.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -101,6 +91,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql index 5cc8fba65..4af2f8020 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql @@ -57,16 +57,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_2.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_2.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_2.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -133,6 +123,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets__plan0.sql index da0209be0..ab8b4fe8b 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets__plan0.sql @@ -41,16 +41,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_2.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_2.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_2.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -117,6 +107,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_time_constraint__plan0.sql index f8b30e4fc..352194ea8 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_time_constraint__plan0.sql @@ -42,16 +42,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_2.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_2.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_2.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -118,6 +108,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_where_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_where_constraint__plan0.sql index d2b3aa215..be2498019 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_where_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_nested_offsets_with_where_constraint__plan0.sql @@ -46,16 +46,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_2.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_2.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_2.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -122,6 +112,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql index 7e622f5b0..bb8bebae2 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql @@ -26,17 +26,7 @@ FROM ( FROM ( -- Constrain Output with WHERE SELECT - subq_4.metric_time__day - , subq_4.metric_time__week - , subq_4.metric_time__month - , subq_4.metric_time__quarter - , subq_4.metric_time__year - , subq_4.metric_time__extract_year - , subq_4.metric_time__extract_quarter - , subq_4.metric_time__extract_month - , subq_4.metric_time__extract_day - , subq_4.metric_time__extract_dow - , subq_4.metric_time__extract_doy + subq_4.metric_time__month , subq_4.ds__day , subq_4.ds__week , subq_4.ds__month @@ -103,6 +93,16 @@ FROM ( , subq_4.booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy + , subq_4.metric_time__day + , subq_4.metric_time__week + , subq_4.metric_time__quarter + , subq_4.metric_time__year + , subq_4.metric_time__extract_year + , subq_4.metric_time__extract_quarter + , subq_4.metric_time__extract_month + , subq_4.metric_time__extract_day + , subq_4.metric_time__extract_dow + , subq_4.metric_time__extract_doy , subq_4.listing , subq_4.guest , subq_4.host @@ -127,17 +127,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_2.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_2.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_2.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -204,6 +194,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql index e2ef45757..299a5317e 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql @@ -19,8 +19,8 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_12.ds AS metric_time__day - , DATE_TRUNC('month', subq_12.ds) AS metric_time__month + DATE_TRUNC('month', subq_12.ds) AS metric_time__month + , subq_10.metric_time__day AS metric_time__day , subq_10.bookings AS bookings FROM ***************************.mf_time_spine subq_12 INNER JOIN ( diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_metric_multiple_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_metric_multiple_granularities__plan0.sql index 79162bce6..8382aec4a 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_metric_multiple_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_metric_multiple_granularities__plan0.sql @@ -35,16 +35,8 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_2.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_2.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_2.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -111,6 +103,14 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_with_agg_time_dim__plan0.sql index 2b8228302..1ec7288f5 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_to_grain_with_agg_time_dim__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_7.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_7.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_7.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_7.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_7.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_7.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_7.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_7.booking__ds__day) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM subq_7.booking__ds__day) = 0 THEN EXTRACT(dow FROM subq_7.booking__ds__day) + 7 ELSE EXTRACT(dow FROM subq_7.booking__ds__day) END AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_7.booking__ds__day) AS booking__ds__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -289,6 +279,16 @@ FROM ( , subq_6.paid_at__extract_day AS paid_at__extract_day , subq_6.paid_at__extract_dow AS paid_at__extract_dow , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , subq_6.booking__ds__week AS booking__ds__week + , subq_6.booking__ds__month AS booking__ds__month + , subq_6.booking__ds__quarter AS booking__ds__quarter + , subq_6.booking__ds__year AS booking__ds__year + , subq_6.booking__ds__extract_year AS booking__ds__extract_year + , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_6.booking__ds__extract_month AS booking__ds__extract_month + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql index b2e4acb8f..cfab4f600 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql @@ -32,17 +32,7 @@ FROM ( FROM ( -- Constrain Output with WHERE SELECT - subq_4.metric_time__day - , subq_4.metric_time__week - , subq_4.metric_time__month - , subq_4.metric_time__quarter - , subq_4.metric_time__year - , subq_4.metric_time__extract_year - , subq_4.metric_time__extract_quarter - , subq_4.metric_time__extract_month - , subq_4.metric_time__extract_day - , subq_4.metric_time__extract_dow - , subq_4.metric_time__extract_doy + subq_4.metric_time__month , subq_4.ds__day , subq_4.ds__week , subq_4.ds__month @@ -109,6 +99,16 @@ FROM ( , subq_4.booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy + , subq_4.metric_time__day + , subq_4.metric_time__week + , subq_4.metric_time__quarter + , subq_4.metric_time__year + , subq_4.metric_time__extract_year + , subq_4.metric_time__extract_quarter + , subq_4.metric_time__extract_month + , subq_4.metric_time__extract_day + , subq_4.metric_time__extract_dow + , subq_4.metric_time__extract_doy , subq_4.listing , subq_4.guest , subq_4.host @@ -133,17 +133,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_2.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_2.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_2.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -210,6 +200,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql index 2608a60ba..c84292cba 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql @@ -25,8 +25,8 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_19.ds AS metric_time__day - , DATE_TRUNC('month', subq_19.ds) AS metric_time__month + DATE_TRUNC('month', subq_19.ds) AS metric_time__month + , DATE_TRUNC('day', bookings_source_src_28000.ds) AS metric_time__day , bookings_source_src_28000.booking_value AS booking_value FROM ***************************.mf_time_spine subq_19 INNER JOIN diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_metric_multiple_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_metric_multiple_granularities__plan0.sql index 83d556f54..8855b65d2 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_metric_multiple_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_metric_multiple_granularities__plan0.sql @@ -43,16 +43,8 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_2.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_2.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_2.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -119,6 +111,14 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_agg_time_dim__plan0.sql index 47ef72345..b10fa0521 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_agg_time_dim__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_7.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_7.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_7.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_7.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_7.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_7.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_7.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_7.booking__ds__day) AS booking__ds__extract_day - , CASE WHEN EXTRACT(dow FROM subq_7.booking__ds__day) = 0 THEN EXTRACT(dow FROM subq_7.booking__ds__day) + 7 ELSE EXTRACT(dow FROM subq_7.booking__ds__day) END AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_7.booking__ds__day) AS booking__ds__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -289,6 +279,16 @@ FROM ( , subq_6.paid_at__extract_day AS paid_at__extract_day , subq_6.paid_at__extract_dow AS paid_at__extract_dow , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , subq_6.booking__ds__week AS booking__ds__week + , subq_6.booking__ds__month AS booking__ds__month + , subq_6.booking__ds__quarter AS booking__ds__quarter + , subq_6.booking__ds__year AS booking__ds__year + , subq_6.booking__ds__extract_year AS booking__ds__extract_year + , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_6.booking__ds__extract_month AS booking__ds__extract_month + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_time_offset_metric_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_time_offset_metric_with_time_constraint__plan0.sql index 37b3e9f49..80650d8d7 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_time_offset_metric_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_time_offset_metric_with_time_constraint__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_2.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_2.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_2.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -101,6 +91,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql index c2623ba16..557d1e6fe 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Constrain Time Range to [2019-12-19T00:00:00, 2020-01-02T00:00:00] SELECT subq_7.metric_time__day - , subq_7.metric_time__week - , subq_7.metric_time__month - , subq_7.metric_time__quarter - , subq_7.metric_time__year - , subq_7.metric_time__extract_year - , subq_7.metric_time__extract_quarter - , subq_7.metric_time__extract_month - , subq_7.metric_time__extract_day - , subq_7.metric_time__extract_dow - , subq_7.metric_time__extract_doy , subq_7.ds__day , subq_7.ds__week , subq_7.ds__month @@ -101,6 +91,16 @@ FROM ( , subq_7.booking__paid_at__extract_day , subq_7.booking__paid_at__extract_dow , subq_7.booking__paid_at__extract_doy + , subq_7.metric_time__week + , subq_7.metric_time__month + , subq_7.metric_time__quarter + , subq_7.metric_time__year + , subq_7.metric_time__extract_year + , subq_7.metric_time__extract_quarter + , subq_7.metric_time__extract_month + , subq_7.metric_time__extract_day + , subq_7.metric_time__extract_dow + , subq_7.metric_time__extract_doy , subq_7.listing , subq_7.guest , subq_7.host @@ -126,16 +126,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_5.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_5.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_5.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_5.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_5.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_5.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_5.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_5.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_5.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_5.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_5.metric_time__day) AS 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 @@ -202,6 +192,16 @@ FROM ( , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , 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.guest AS guest , subq_4.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql index 4a1ea1fbc..ae2f922da 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql @@ -25,11 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__month AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__month) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__month) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__month) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__month) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__month) AS metric_time__extract_month , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year @@ -42,6 +37,11 @@ FROM ( , subq_1.booking_monthly__ds__extract_year AS booking_monthly__ds__extract_year , subq_1.booking_monthly__ds__extract_quarter AS booking_monthly__ds__extract_quarter , subq_1.booking_monthly__ds__extract_month AS booking_monthly__ds__extract_month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month , subq_1.listing AS listing , subq_1.booking_monthly__listing AS booking_monthly__listing , subq_1.bookings_monthly AS bookings_monthly diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain__plan0.sql index 62142e1dd..c16d612c3 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index 64a790683..ca4a37232 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -245,17 +245,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__day AS metric_time__day + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window__plan0.sql index a8e292868..e6f81dcfd 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_granularity__plan0.sql index 04b5e8c1c..7561adfaa 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -245,17 +245,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__day AS metric_time__day + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index e616d74d7..40e536ad6 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -31,16 +31,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -107,6 +97,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -356,16 +356,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_10.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_10.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_10.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_10.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_10.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_10.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_10.metric_time__day) AS metric_time__extract_doy , subq_9.ds__day AS ds__day , subq_9.ds__week AS ds__week , subq_9.ds__month AS ds__month @@ -432,6 +422,16 @@ FROM ( , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_9.metric_time__week AS metric_time__week + , subq_9.metric_time__month AS metric_time__month + , subq_9.metric_time__quarter AS metric_time__quarter + , subq_9.metric_time__year AS metric_time__year + , subq_9.metric_time__extract_year AS metric_time__extract_year + , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_9.metric_time__extract_month AS metric_time__extract_month + , subq_9.metric_time__extract_day AS metric_time__extract_day + , subq_9.metric_time__extract_dow AS metric_time__extract_dow + , subq_9.metric_time__extract_doy AS metric_time__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index 2e09e204d..4d53c9768 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -30,17 +30,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -107,6 +97,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -356,17 +356,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_10.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_10.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_10.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_10.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_10.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_10.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_10.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year , subq_9.ds__day AS ds__day , subq_9.ds__week AS ds__week , subq_9.ds__month AS ds__month @@ -433,6 +423,16 @@ FROM ( , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_9.metric_time__day AS metric_time__day + , subq_9.metric_time__week AS metric_time__week + , subq_9.metric_time__month AS metric_time__month + , subq_9.metric_time__quarter AS metric_time__quarter + , subq_9.metric_time__extract_year AS metric_time__extract_year + , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_9.metric_time__extract_month AS metric_time__extract_month + , subq_9.metric_time__extract_day AS metric_time__extract_day + , subq_9.metric_time__extract_dow AS metric_time__extract_dow + , subq_9.metric_time__extract_doy AS metric_time__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_time_filter__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_time_filter__plan0.sql index 0de51ffc4..c884a8a58 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_time_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_metric_with_offset_window_and_time_filter__plan0.sql @@ -349,16 +349,6 @@ FROM ( -- Constrain Output with WHERE SELECT subq_10.metric_time__day - , subq_10.metric_time__week - , subq_10.metric_time__month - , subq_10.metric_time__quarter - , subq_10.metric_time__year - , subq_10.metric_time__extract_year - , subq_10.metric_time__extract_quarter - , subq_10.metric_time__extract_month - , subq_10.metric_time__extract_day - , subq_10.metric_time__extract_dow - , subq_10.metric_time__extract_doy , subq_10.ds__day , subq_10.ds__week , subq_10.ds__month @@ -425,6 +415,16 @@ FROM ( , subq_10.booking__paid_at__extract_day , subq_10.booking__paid_at__extract_dow , subq_10.booking__paid_at__extract_doy + , subq_10.metric_time__week + , subq_10.metric_time__month + , subq_10.metric_time__quarter + , subq_10.metric_time__year + , subq_10.metric_time__extract_year + , subq_10.metric_time__extract_quarter + , subq_10.metric_time__extract_month + , subq_10.metric_time__extract_day + , subq_10.metric_time__extract_dow + , subq_10.metric_time__extract_doy , subq_10.listing , subq_10.guest , subq_10.host @@ -450,16 +450,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_8.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_8.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_8.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_8.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_8.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_8.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_8.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_8.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_8.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_8.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_8.metric_time__day) AS metric_time__extract_doy , subq_7.ds__day AS ds__day , subq_7.ds__week AS ds__week , subq_7.ds__month AS ds__month @@ -526,6 +516,16 @@ FROM ( , subq_7.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_7.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_7.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_7.metric_time__week AS metric_time__week + , subq_7.metric_time__month AS metric_time__month + , subq_7.metric_time__quarter AS metric_time__quarter + , subq_7.metric_time__year AS metric_time__year + , subq_7.metric_time__extract_year AS metric_time__extract_year + , subq_7.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_7.metric_time__extract_month AS metric_time__extract_month + , 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_7.listing AS listing , subq_7.guest AS guest , subq_7.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_cumulative_metric__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_cumulative_metric__plan0.sql index 437e55458..12bbfe786 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_cumulative_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_cumulative_metric__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_5.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_5.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_5.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_5.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_5.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_5.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_5.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_5.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_5.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_5.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_5.metric_time__day) AS 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 @@ -101,6 +91,16 @@ FROM ( , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , 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.guest AS guest , subq_4.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_agg_time_dim__plan0.sql index 73774979c..115c00e1b 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_agg_time_dim__plan0.sql @@ -31,16 +31,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_2.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_2.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_2.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_2.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_2.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_2.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_2.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_2.booking__ds__day) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM subq_2.booking__ds__day) AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_2.booking__ds__day) AS booking__ds__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -74,6 +64,16 @@ FROM ( , subq_1.paid_at__extract_day AS paid_at__extract_day , subq_1.paid_at__extract_dow AS paid_at__extract_dow , subq_1.paid_at__extract_doy AS paid_at__extract_doy + , subq_1.booking__ds__week AS booking__ds__week + , subq_1.booking__ds__month AS booking__ds__month + , subq_1.booking__ds__quarter AS booking__ds__quarter + , subq_1.booking__ds__year AS booking__ds__year + , subq_1.booking__ds__extract_year AS booking__ds__extract_year + , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_1.booking__ds__extract_month AS booking__ds__extract_month + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_one_input_metric__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_one_input_metric__plan0.sql index bc36f5bb5..3e0efcd5a 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -101,6 +91,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql index b45f7776e..495c63745 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql @@ -57,16 +57,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -133,6 +123,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets__plan0.sql index 890155884..b86781bf0 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets__plan0.sql @@ -41,16 +41,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -117,6 +107,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_time_constraint__plan0.sql index 10be64ac1..769d23bec 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_time_constraint__plan0.sql @@ -42,16 +42,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -118,6 +108,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_where_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_where_constraint__plan0.sql index c50436acd..c4dd0ffbe 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_where_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_nested_offsets_with_where_constraint__plan0.sql @@ -46,16 +46,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -122,6 +112,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql index 1b8d5f3c7..5efb6860c 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql @@ -26,17 +26,7 @@ FROM ( FROM ( -- Constrain Output with WHERE SELECT - subq_4.metric_time__day - , subq_4.metric_time__week - , subq_4.metric_time__month - , subq_4.metric_time__quarter - , subq_4.metric_time__year - , subq_4.metric_time__extract_year - , subq_4.metric_time__extract_quarter - , subq_4.metric_time__extract_month - , subq_4.metric_time__extract_day - , subq_4.metric_time__extract_dow - , subq_4.metric_time__extract_doy + subq_4.metric_time__month , subq_4.ds__day , subq_4.ds__week , subq_4.ds__month @@ -103,6 +93,16 @@ FROM ( , subq_4.booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy + , subq_4.metric_time__day + , subq_4.metric_time__week + , subq_4.metric_time__quarter + , subq_4.metric_time__year + , subq_4.metric_time__extract_year + , subq_4.metric_time__extract_quarter + , subq_4.metric_time__extract_month + , subq_4.metric_time__extract_day + , subq_4.metric_time__extract_dow + , subq_4.metric_time__extract_doy , subq_4.listing , subq_4.guest , subq_4.host @@ -127,17 +127,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -204,6 +194,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql index 2fec95707..a018fc10a 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql @@ -19,8 +19,8 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_12.ds AS metric_time__day - , DATE_TRUNC('month', subq_12.ds) AS metric_time__month + DATE_TRUNC('month', subq_12.ds) AS metric_time__month + , subq_10.metric_time__day AS metric_time__day , subq_10.bookings AS bookings FROM ***************************.mf_time_spine subq_12 INNER JOIN ( diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_metric_multiple_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_metric_multiple_granularities__plan0.sql index c9aaa5d3c..f90e5fa8f 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_metric_multiple_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_metric_multiple_granularities__plan0.sql @@ -35,16 +35,8 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -111,6 +103,14 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_with_agg_time_dim__plan0.sql index 0add7b9ae..b75aa84f9 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_to_grain_with_agg_time_dim__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_7.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_7.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_7.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_7.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_7.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_7.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_7.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_7.booking__ds__day) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM subq_7.booking__ds__day) AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_7.booking__ds__day) AS booking__ds__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -289,6 +279,16 @@ FROM ( , subq_6.paid_at__extract_day AS paid_at__extract_day , subq_6.paid_at__extract_dow AS paid_at__extract_dow , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , subq_6.booking__ds__week AS booking__ds__week + , subq_6.booking__ds__month AS booking__ds__month + , subq_6.booking__ds__quarter AS booking__ds__quarter + , subq_6.booking__ds__year AS booking__ds__year + , subq_6.booking__ds__extract_year AS booking__ds__extract_year + , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_6.booking__ds__extract_month AS booking__ds__extract_month + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql index b70bf53df..ac73be5b5 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql @@ -32,17 +32,7 @@ FROM ( FROM ( -- Constrain Output with WHERE SELECT - subq_4.metric_time__day - , subq_4.metric_time__week - , subq_4.metric_time__month - , subq_4.metric_time__quarter - , subq_4.metric_time__year - , subq_4.metric_time__extract_year - , subq_4.metric_time__extract_quarter - , subq_4.metric_time__extract_month - , subq_4.metric_time__extract_day - , subq_4.metric_time__extract_dow - , subq_4.metric_time__extract_doy + subq_4.metric_time__month , subq_4.ds__day , subq_4.ds__week , subq_4.ds__month @@ -109,6 +99,16 @@ FROM ( , subq_4.booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy + , subq_4.metric_time__day + , subq_4.metric_time__week + , subq_4.metric_time__quarter + , subq_4.metric_time__year + , subq_4.metric_time__extract_year + , subq_4.metric_time__extract_quarter + , subq_4.metric_time__extract_month + , subq_4.metric_time__extract_day + , subq_4.metric_time__extract_dow + , subq_4.metric_time__extract_doy , subq_4.listing , subq_4.guest , subq_4.host @@ -133,17 +133,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -210,6 +200,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql index 28159c151..f4ec730fd 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql @@ -25,8 +25,8 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_19.ds AS metric_time__day - , DATE_TRUNC('month', subq_19.ds) AS metric_time__month + DATE_TRUNC('month', subq_19.ds) AS metric_time__month + , DATE_TRUNC('day', bookings_source_src_28000.ds) AS metric_time__day , bookings_source_src_28000.booking_value AS booking_value FROM ***************************.mf_time_spine subq_19 INNER JOIN diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_metric_multiple_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_metric_multiple_granularities__plan0.sql index 1bf348eda..f3b8d2d80 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_metric_multiple_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_metric_multiple_granularities__plan0.sql @@ -43,16 +43,8 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -119,6 +111,14 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_agg_time_dim__plan0.sql index cf02ce98e..5c8fd1589 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_agg_time_dim__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_7.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_7.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_7.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_7.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_7.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_7.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_7.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_7.booking__ds__day) AS booking__ds__extract_day - , EXTRACT(dayofweekiso FROM subq_7.booking__ds__day) AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_7.booking__ds__day) AS booking__ds__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -289,6 +279,16 @@ FROM ( , subq_6.paid_at__extract_day AS paid_at__extract_day , subq_6.paid_at__extract_dow AS paid_at__extract_dow , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , subq_6.booking__ds__week AS booking__ds__week + , subq_6.booking__ds__month AS booking__ds__month + , subq_6.booking__ds__quarter AS booking__ds__quarter + , subq_6.booking__ds__year AS booking__ds__year + , subq_6.booking__ds__extract_year AS booking__ds__extract_year + , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_6.booking__ds__extract_month AS booking__ds__extract_month + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_time_offset_metric_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_time_offset_metric_with_time_constraint__plan0.sql index f7320ca81..4420c336e 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_time_offset_metric_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Snowflake/test_time_offset_metric_with_time_constraint__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -101,6 +91,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql index de3e61401..4fc4a2416 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Constrain Time Range to [2019-12-19T00:00:00, 2020-01-02T00:00:00] SELECT subq_7.metric_time__day - , subq_7.metric_time__week - , subq_7.metric_time__month - , subq_7.metric_time__quarter - , subq_7.metric_time__year - , subq_7.metric_time__extract_year - , subq_7.metric_time__extract_quarter - , subq_7.metric_time__extract_month - , subq_7.metric_time__extract_day - , subq_7.metric_time__extract_dow - , subq_7.metric_time__extract_doy , subq_7.ds__day , subq_7.ds__week , subq_7.ds__month @@ -101,6 +91,16 @@ FROM ( , subq_7.booking__paid_at__extract_day , subq_7.booking__paid_at__extract_dow , subq_7.booking__paid_at__extract_doy + , subq_7.metric_time__week + , subq_7.metric_time__month + , subq_7.metric_time__quarter + , subq_7.metric_time__year + , subq_7.metric_time__extract_year + , subq_7.metric_time__extract_quarter + , subq_7.metric_time__extract_month + , subq_7.metric_time__extract_day + , subq_7.metric_time__extract_dow + , subq_7.metric_time__extract_doy , subq_7.listing , subq_7.guest , subq_7.host @@ -126,16 +126,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_5.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_5.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_5.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_5.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_5.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_5.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_5.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_5.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_5.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_5.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_5.metric_time__day) AS 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 @@ -202,6 +192,16 @@ FROM ( , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , 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.guest AS guest , subq_4.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql index d863e36e6..120935fa1 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql @@ -25,11 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__month AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__month) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__month) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__month) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__month) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__month) AS metric_time__extract_month , subq_1.ds__month AS ds__month , subq_1.ds__quarter AS ds__quarter , subq_1.ds__year AS ds__year @@ -42,6 +37,11 @@ FROM ( , subq_1.booking_monthly__ds__extract_year AS booking_monthly__ds__extract_year , subq_1.booking_monthly__ds__extract_quarter AS booking_monthly__ds__extract_quarter , subq_1.booking_monthly__ds__extract_month AS booking_monthly__ds__extract_month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month , subq_1.listing AS listing , subq_1.booking_monthly__listing AS booking_monthly__listing , subq_1.bookings_monthly AS bookings_monthly diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain__plan0.sql index b206ee786..9289f7021 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql index 1a44e848f..0cf3469d1 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql @@ -245,17 +245,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__day AS metric_time__day + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window__plan0.sql index c5981d5cb..2d5963f8c 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_granularity__plan0.sql index 4512f1dde..c4c52ccc6 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_granularity__plan0.sql @@ -245,17 +245,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__day AS metric_time__day + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_dow AS metric_time__extract_dow + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql index 8f12e7bb5..8f2321e8d 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql @@ -31,16 +31,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -107,6 +97,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -356,16 +356,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_10.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_10.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_10.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_10.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_10.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_10.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_10.metric_time__day) AS metric_time__extract_doy , subq_9.ds__day AS ds__day , subq_9.ds__week AS ds__week , subq_9.ds__month AS ds__month @@ -432,6 +422,16 @@ FROM ( , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_9.metric_time__week AS metric_time__week + , subq_9.metric_time__month AS metric_time__month + , subq_9.metric_time__quarter AS metric_time__quarter + , subq_9.metric_time__year AS metric_time__year + , subq_9.metric_time__extract_year AS metric_time__extract_year + , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_9.metric_time__extract_month AS metric_time__extract_month + , subq_9.metric_time__extract_day AS metric_time__extract_day + , subq_9.metric_time__extract_dow AS metric_time__extract_dow + , subq_9.metric_time__extract_doy AS metric_time__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql index f86c7dbc0..cf738ae11 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql @@ -30,17 +30,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -107,6 +97,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host @@ -356,17 +356,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_10.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_10.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_10.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_10.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_10.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_10.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_10.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year , subq_9.ds__day AS ds__day , subq_9.ds__week AS ds__week , subq_9.ds__month AS ds__month @@ -433,6 +423,16 @@ FROM ( , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_9.metric_time__day AS metric_time__day + , subq_9.metric_time__week AS metric_time__week + , subq_9.metric_time__month AS metric_time__month + , subq_9.metric_time__quarter AS metric_time__quarter + , subq_9.metric_time__extract_year AS metric_time__extract_year + , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_9.metric_time__extract_month AS metric_time__extract_month + , subq_9.metric_time__extract_day AS metric_time__extract_day + , subq_9.metric_time__extract_dow AS metric_time__extract_dow + , subq_9.metric_time__extract_doy AS metric_time__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_time_filter__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_time_filter__plan0.sql index 7f723cac3..a0eb21571 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_time_filter__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_metric_with_offset_window_and_time_filter__plan0.sql @@ -349,16 +349,6 @@ FROM ( -- Constrain Output with WHERE SELECT subq_10.metric_time__day - , subq_10.metric_time__week - , subq_10.metric_time__month - , subq_10.metric_time__quarter - , subq_10.metric_time__year - , subq_10.metric_time__extract_year - , subq_10.metric_time__extract_quarter - , subq_10.metric_time__extract_month - , subq_10.metric_time__extract_day - , subq_10.metric_time__extract_dow - , subq_10.metric_time__extract_doy , subq_10.ds__day , subq_10.ds__week , subq_10.ds__month @@ -425,6 +415,16 @@ FROM ( , subq_10.booking__paid_at__extract_day , subq_10.booking__paid_at__extract_dow , subq_10.booking__paid_at__extract_doy + , subq_10.metric_time__week + , subq_10.metric_time__month + , subq_10.metric_time__quarter + , subq_10.metric_time__year + , subq_10.metric_time__extract_year + , subq_10.metric_time__extract_quarter + , subq_10.metric_time__extract_month + , subq_10.metric_time__extract_day + , subq_10.metric_time__extract_dow + , subq_10.metric_time__extract_doy , subq_10.listing , subq_10.guest , subq_10.host @@ -450,16 +450,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_8.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_8.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_8.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_8.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_8.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_8.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_8.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_8.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_8.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_8.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_8.metric_time__day) AS metric_time__extract_doy , subq_7.ds__day AS ds__day , subq_7.ds__week AS ds__week , subq_7.ds__month AS ds__month @@ -526,6 +516,16 @@ FROM ( , subq_7.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_7.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_7.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_7.metric_time__week AS metric_time__week + , subq_7.metric_time__month AS metric_time__month + , subq_7.metric_time__quarter AS metric_time__quarter + , subq_7.metric_time__year AS metric_time__year + , subq_7.metric_time__extract_year AS metric_time__extract_year + , subq_7.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_7.metric_time__extract_month AS metric_time__extract_month + , 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_7.listing AS listing , subq_7.guest AS guest , subq_7.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_cumulative_metric__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_cumulative_metric__plan0.sql index 85b6e8fd7..32b446285 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_cumulative_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_cumulative_metric__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_5.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_5.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_5.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_5.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_5.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_5.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_5.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_5.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_5.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_5.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_5.metric_time__day) AS 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 @@ -101,6 +91,16 @@ FROM ( , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , 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.guest AS guest , subq_4.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_agg_time_dim__plan0.sql index c746f2616..58c9cbe4f 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_agg_time_dim__plan0.sql @@ -31,16 +31,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_2.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_2.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_2.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_2.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_2.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_2.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_2.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_2.booking__ds__day) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_2.booking__ds__day) AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_2.booking__ds__day) AS booking__ds__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -74,6 +64,16 @@ FROM ( , subq_1.paid_at__extract_day AS paid_at__extract_day , subq_1.paid_at__extract_dow AS paid_at__extract_dow , subq_1.paid_at__extract_doy AS paid_at__extract_doy + , subq_1.booking__ds__week AS booking__ds__week + , subq_1.booking__ds__month AS booking__ds__month + , subq_1.booking__ds__quarter AS booking__ds__quarter + , subq_1.booking__ds__year AS booking__ds__year + , subq_1.booking__ds__extract_year AS booking__ds__extract_year + , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_1.booking__ds__extract_month AS booking__ds__extract_month + , subq_1.booking__ds__extract_day AS booking__ds__extract_day + , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_one_input_metric__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_one_input_metric__plan0.sql index 854446fc3..f30f6fc14 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_one_input_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_derived_offset_metric_with_one_input_metric__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -101,6 +91,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql index 11de21528..f29e58481 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql @@ -57,16 +57,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -133,6 +123,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets__plan0.sql index d88fac446..d2801edc7 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets__plan0.sql @@ -41,16 +41,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -117,6 +107,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_time_constraint__plan0.sql index a8c04f20d..4639f0b65 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_time_constraint__plan0.sql @@ -42,16 +42,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -118,6 +108,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_where_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_where_constraint__plan0.sql index 7934462a2..c60220adc 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_where_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_nested_offsets_with_where_constraint__plan0.sql @@ -46,16 +46,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -122,6 +112,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql index 714a52605..b710e45a9 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0.sql @@ -26,17 +26,7 @@ FROM ( FROM ( -- Constrain Output with WHERE SELECT - subq_4.metric_time__day - , subq_4.metric_time__week - , subq_4.metric_time__month - , subq_4.metric_time__quarter - , subq_4.metric_time__year - , subq_4.metric_time__extract_year - , subq_4.metric_time__extract_quarter - , subq_4.metric_time__extract_month - , subq_4.metric_time__extract_day - , subq_4.metric_time__extract_dow - , subq_4.metric_time__extract_doy + subq_4.metric_time__month , subq_4.ds__day , subq_4.ds__week , subq_4.ds__month @@ -103,6 +93,16 @@ FROM ( , subq_4.booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy + , subq_4.metric_time__day + , subq_4.metric_time__week + , subq_4.metric_time__quarter + , subq_4.metric_time__year + , subq_4.metric_time__extract_year + , subq_4.metric_time__extract_quarter + , subq_4.metric_time__extract_month + , subq_4.metric_time__extract_day + , subq_4.metric_time__extract_dow + , subq_4.metric_time__extract_doy , subq_4.listing , subq_4.guest , subq_4.host @@ -127,17 +127,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -204,6 +194,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql index 600f39647..a8f5ddb16 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_metric_filter_and_query_have_different_granularities__plan0_optimized.sql @@ -19,8 +19,8 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_12.ds AS metric_time__day - , DATE_TRUNC('month', subq_12.ds) AS metric_time__month + DATE_TRUNC('month', subq_12.ds) AS metric_time__month + , subq_10.metric_time__day AS metric_time__day , subq_10.bookings AS bookings FROM ***************************.mf_time_spine subq_12 INNER JOIN ( diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_metric_multiple_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_metric_multiple_granularities__plan0.sql index dde80c8c6..6d9f0250a 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_metric_multiple_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_metric_multiple_granularities__plan0.sql @@ -35,16 +35,8 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -111,6 +103,14 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_with_agg_time_dim__plan0.sql index b3ce0598f..d949c4319 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_to_grain_with_agg_time_dim__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_7.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_7.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_7.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_7.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_7.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_7.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_7.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_7.booking__ds__day) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_7.booking__ds__day) AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_7.booking__ds__day) AS booking__ds__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -289,6 +279,16 @@ FROM ( , subq_6.paid_at__extract_day AS paid_at__extract_day , subq_6.paid_at__extract_dow AS paid_at__extract_dow , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , subq_6.booking__ds__week AS booking__ds__week + , subq_6.booking__ds__month AS booking__ds__month + , subq_6.booking__ds__quarter AS booking__ds__quarter + , subq_6.booking__ds__year AS booking__ds__year + , subq_6.booking__ds__extract_year AS booking__ds__extract_year + , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_6.booking__ds__extract_month AS booking__ds__extract_month + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql index 83e94c14b..fabed71c9 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_metric_filter_and_query_have_different_granularities__plan0.sql @@ -32,17 +32,7 @@ FROM ( FROM ( -- Constrain Output with WHERE SELECT - subq_4.metric_time__day - , subq_4.metric_time__week - , subq_4.metric_time__month - , subq_4.metric_time__quarter - , subq_4.metric_time__year - , subq_4.metric_time__extract_year - , subq_4.metric_time__extract_quarter - , subq_4.metric_time__extract_month - , subq_4.metric_time__extract_day - , subq_4.metric_time__extract_dow - , subq_4.metric_time__extract_doy + subq_4.metric_time__month , subq_4.ds__day , subq_4.ds__week , subq_4.ds__month @@ -109,6 +99,16 @@ FROM ( , subq_4.booking__paid_at__extract_day , subq_4.booking__paid_at__extract_dow , subq_4.booking__paid_at__extract_doy + , subq_4.metric_time__day + , subq_4.metric_time__week + , subq_4.metric_time__quarter + , subq_4.metric_time__year + , subq_4.metric_time__extract_year + , subq_4.metric_time__extract_quarter + , subq_4.metric_time__extract_month + , subq_4.metric_time__extract_day + , subq_4.metric_time__extract_dow + , subq_4.metric_time__extract_doy , subq_4.listing , subq_4.guest , subq_4.host @@ -133,17 +133,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy + DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -210,6 +200,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql index c2acb8801..b65cacd2e 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_metric_filter_and_query_have_different_granularities__plan0_optimized.sql @@ -25,8 +25,8 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_19.ds AS metric_time__day - , DATE_TRUNC('month', subq_19.ds) AS metric_time__month + DATE_TRUNC('month', subq_19.ds) AS metric_time__month + , DATE_TRUNC('day', bookings_source_src_28000.ds) AS metric_time__day , bookings_source_src_28000.booking_value AS booking_value FROM ***************************.mf_time_spine subq_19 INNER JOIN diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_metric_multiple_granularities__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_metric_multiple_granularities__plan0.sql index 3de997c20..77678f8b6 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_metric_multiple_granularities__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_metric_multiple_granularities__plan0.sql @@ -43,16 +43,8 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -119,6 +111,14 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_agg_time_dim__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_agg_time_dim__plan0.sql index 0810e1f3e..ec42f54a7 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_agg_time_dim__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_agg_time_dim__plan0.sql @@ -246,16 +246,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_7.booking__ds__day AS booking__ds__day - , DATE_TRUNC('week', subq_7.booking__ds__day) AS booking__ds__week - , DATE_TRUNC('month', subq_7.booking__ds__day) AS booking__ds__month - , DATE_TRUNC('quarter', subq_7.booking__ds__day) AS booking__ds__quarter - , DATE_TRUNC('year', subq_7.booking__ds__day) AS booking__ds__year - , EXTRACT(year FROM subq_7.booking__ds__day) AS booking__ds__extract_year - , EXTRACT(quarter FROM subq_7.booking__ds__day) AS booking__ds__extract_quarter - , EXTRACT(month FROM subq_7.booking__ds__day) AS booking__ds__extract_month - , EXTRACT(day FROM subq_7.booking__ds__day) AS booking__ds__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_7.booking__ds__day) AS booking__ds__extract_dow - , EXTRACT(doy FROM subq_7.booking__ds__day) AS booking__ds__extract_doy , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -289,6 +279,16 @@ FROM ( , subq_6.paid_at__extract_day AS paid_at__extract_day , subq_6.paid_at__extract_dow AS paid_at__extract_dow , subq_6.paid_at__extract_doy AS paid_at__extract_doy + , subq_6.booking__ds__week AS booking__ds__week + , subq_6.booking__ds__month AS booking__ds__month + , subq_6.booking__ds__quarter AS booking__ds__quarter + , subq_6.booking__ds__year AS booking__ds__year + , subq_6.booking__ds__extract_year AS booking__ds__extract_year + , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter + , subq_6.booking__ds__extract_month AS booking__ds__extract_month + , subq_6.booking__ds__extract_day AS booking__ds__extract_day + , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow + , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month diff --git a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_time_offset_metric_with_time_constraint__plan0.sql b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_time_offset_metric_with_time_constraint__plan0.sql index a3cb95757..cbbf2eae8 100644 --- a/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_time_offset_metric_with_time_constraint__plan0.sql +++ b/tests_metricflow/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Trino/test_time_offset_metric_with_time_constraint__plan0.sql @@ -25,16 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_2.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__day) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -101,6 +91,16 @@ FROM ( , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.listing AS listing , subq_1.guest AS guest , subq_1.host AS host diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0.sql index 7acac83ff..846bb51c7 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/BigQuery/test_derived_fill_nulls_for_one_input_metric__plan0.sql @@ -260,16 +260,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_10.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_10.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_10.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_10.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_10.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_10.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_10.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_10.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_10.metric_time__day) AS metric_time__extract_doy , subq_9.ds__day AS ds__day , subq_9.ds__week AS ds__week , subq_9.ds__month AS ds__month @@ -336,6 +326,16 @@ FROM ( , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_9.metric_time__week AS metric_time__week + , subq_9.metric_time__month AS metric_time__month + , subq_9.metric_time__quarter AS metric_time__quarter + , subq_9.metric_time__year AS metric_time__year + , subq_9.metric_time__extract_year AS metric_time__extract_year + , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_9.metric_time__extract_month AS metric_time__extract_month + , subq_9.metric_time__extract_day AS metric_time__extract_day + , subq_9.metric_time__extract_dow AS metric_time__extract_dow + , subq_9.metric_time__extract_doy AS metric_time__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_derived_fill_nulls_for_one_input_metric__plan0.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_derived_fill_nulls_for_one_input_metric__plan0.sql index aea9aa107..0b3d2f158 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_derived_fill_nulls_for_one_input_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Databricks/test_derived_fill_nulls_for_one_input_metric__plan0.sql @@ -260,16 +260,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_10.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_10.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_10.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_10.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_10.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_10.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_10.metric_time__day) AS metric_time__extract_doy , subq_9.ds__day AS ds__day , subq_9.ds__week AS ds__week , subq_9.ds__month AS ds__month @@ -336,6 +326,16 @@ FROM ( , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_9.metric_time__week AS metric_time__week + , subq_9.metric_time__month AS metric_time__month + , subq_9.metric_time__quarter AS metric_time__quarter + , subq_9.metric_time__year AS metric_time__year + , subq_9.metric_time__extract_year AS metric_time__extract_year + , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_9.metric_time__extract_month AS metric_time__extract_month + , subq_9.metric_time__extract_day AS metric_time__extract_day + , subq_9.metric_time__extract_dow AS metric_time__extract_dow + , subq_9.metric_time__extract_doy AS metric_time__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_derived_fill_nulls_for_one_input_metric__plan0.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_derived_fill_nulls_for_one_input_metric__plan0.sql index 7b7c3d944..805a3ef5e 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_derived_fill_nulls_for_one_input_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/DuckDB/test_derived_fill_nulls_for_one_input_metric__plan0.sql @@ -260,16 +260,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_10.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_10.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_10.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_10.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_10.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_10.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_10.metric_time__day) AS metric_time__extract_doy , subq_9.ds__day AS ds__day , subq_9.ds__week AS ds__week , subq_9.ds__month AS ds__month @@ -336,6 +326,16 @@ FROM ( , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_9.metric_time__week AS metric_time__week + , subq_9.metric_time__month AS metric_time__month + , subq_9.metric_time__quarter AS metric_time__quarter + , subq_9.metric_time__year AS metric_time__year + , subq_9.metric_time__extract_year AS metric_time__extract_year + , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_9.metric_time__extract_month AS metric_time__extract_month + , subq_9.metric_time__extract_day AS metric_time__extract_day + , subq_9.metric_time__extract_dow AS metric_time__extract_dow + , subq_9.metric_time__extract_doy AS metric_time__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_derived_fill_nulls_for_one_input_metric__plan0.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_derived_fill_nulls_for_one_input_metric__plan0.sql index 9dce854a0..72cb06db0 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_derived_fill_nulls_for_one_input_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Postgres/test_derived_fill_nulls_for_one_input_metric__plan0.sql @@ -260,16 +260,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_10.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_10.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_10.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_10.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_10.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_10.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_10.metric_time__day) AS metric_time__extract_doy , subq_9.ds__day AS ds__day , subq_9.ds__week AS ds__week , subq_9.ds__month AS ds__month @@ -336,6 +326,16 @@ FROM ( , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_9.metric_time__week AS metric_time__week + , subq_9.metric_time__month AS metric_time__month + , subq_9.metric_time__quarter AS metric_time__quarter + , subq_9.metric_time__year AS metric_time__year + , subq_9.metric_time__extract_year AS metric_time__extract_year + , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_9.metric_time__extract_month AS metric_time__extract_month + , subq_9.metric_time__extract_day AS metric_time__extract_day + , subq_9.metric_time__extract_dow AS metric_time__extract_dow + , subq_9.metric_time__extract_doy AS metric_time__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_derived_fill_nulls_for_one_input_metric__plan0.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_derived_fill_nulls_for_one_input_metric__plan0.sql index 076e11a11..fce0b68b1 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_derived_fill_nulls_for_one_input_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Redshift/test_derived_fill_nulls_for_one_input_metric__plan0.sql @@ -260,16 +260,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_10.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_10.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_10.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_10.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_10.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_10.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_10.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_10.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_10.metric_time__day) AS metric_time__extract_doy , subq_9.ds__day AS ds__day , subq_9.ds__week AS ds__week , subq_9.ds__month AS ds__month @@ -336,6 +326,16 @@ FROM ( , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_9.metric_time__week AS metric_time__week + , subq_9.metric_time__month AS metric_time__month + , subq_9.metric_time__quarter AS metric_time__quarter + , subq_9.metric_time__year AS metric_time__year + , subq_9.metric_time__extract_year AS metric_time__extract_year + , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_9.metric_time__extract_month AS metric_time__extract_month + , subq_9.metric_time__extract_day AS metric_time__extract_day + , subq_9.metric_time__extract_dow AS metric_time__extract_dow + , subq_9.metric_time__extract_doy AS metric_time__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_derived_fill_nulls_for_one_input_metric__plan0.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_derived_fill_nulls_for_one_input_metric__plan0.sql index 0b707cdc0..9ce54cd8e 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_derived_fill_nulls_for_one_input_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Snowflake/test_derived_fill_nulls_for_one_input_metric__plan0.sql @@ -260,16 +260,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_10.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_10.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_10.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_10.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_10.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_10.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_10.metric_time__day) AS metric_time__extract_doy , subq_9.ds__day AS ds__day , subq_9.ds__week AS ds__week , subq_9.ds__month AS ds__month @@ -336,6 +326,16 @@ FROM ( , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_9.metric_time__week AS metric_time__week + , subq_9.metric_time__month AS metric_time__month + , subq_9.metric_time__quarter AS metric_time__quarter + , subq_9.metric_time__year AS metric_time__year + , subq_9.metric_time__extract_year AS metric_time__extract_year + , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_9.metric_time__extract_month AS metric_time__extract_month + , subq_9.metric_time__extract_day AS metric_time__extract_day + , subq_9.metric_time__extract_dow AS metric_time__extract_dow + , subq_9.metric_time__extract_doy AS metric_time__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host diff --git a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_derived_fill_nulls_for_one_input_metric__plan0.sql b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_derived_fill_nulls_for_one_input_metric__plan0.sql index fa437bc1f..490a80a6f 100644 --- a/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_derived_fill_nulls_for_one_input_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_fill_nulls_with_rendering.py/SqlQueryPlan/Trino/test_derived_fill_nulls_for_one_input_metric__plan0.sql @@ -260,16 +260,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_10.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_10.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_10.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_10.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_10.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_10.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_10.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_10.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_10.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_10.metric_time__day) AS metric_time__extract_doy , subq_9.ds__day AS ds__day , subq_9.ds__week AS ds__week , subq_9.ds__month AS ds__month @@ -336,6 +326,16 @@ FROM ( , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_9.metric_time__week AS metric_time__week + , subq_9.metric_time__month AS metric_time__month + , subq_9.metric_time__quarter AS metric_time__quarter + , subq_9.metric_time__year AS metric_time__year + , subq_9.metric_time__extract_year AS metric_time__extract_year + , subq_9.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_9.metric_time__extract_month AS metric_time__extract_month + , subq_9.metric_time__extract_day AS metric_time__extract_day + , subq_9.metric_time__extract_dow AS metric_time__extract_dow + , subq_9.metric_time__extract_doy AS metric_time__extract_doy , subq_9.listing AS listing , subq_9.guest AS guest , subq_9.host AS host diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql index b8e42a253..ab2139687 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_date_part__plan0.sql @@ -245,17 +245,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_7.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_7.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_7.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_7.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_7.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_7.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_7.metric_time__day) AS metric_time__extract_doy + IF(EXTRACT(dayofweek FROM subq_7.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_7.metric_time__day) - 1) AS metric_time__extract_dow , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__day AS metric_time__day + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_subdaily_offset_to_grain_metric__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_subdaily_offset_to_grain_metric__plan0.sql index 285492d2d..f6cbd6340 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_subdaily_offset_to_grain_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_subdaily_offset_to_grain_metric__plan0.sql @@ -25,17 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__hour AS metric_time__hour - , DATETIME_TRUNC(subq_2.metric_time__hour, day) AS metric_time__day - , DATETIME_TRUNC(subq_2.metric_time__hour, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_2.metric_time__hour, month) AS metric_time__month - , DATETIME_TRUNC(subq_2.metric_time__hour, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_2.metric_time__hour, year) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__hour) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__hour) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__hour) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__hour) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_2.metric_time__hour) = 1, 7, EXTRACT(dayofweek FROM subq_2.metric_time__hour) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_2.metric_time__hour) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -210,6 +199,17 @@ FROM ( , subq_1.user__archived_at__extract_day AS user__archived_at__extract_day , subq_1.user__archived_at__extract_dow AS user__archived_at__extract_dow , subq_1.user__archived_at__extract_doy AS user__archived_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.user AS user , subq_1.home_state AS home_state , subq_1.user__home_state AS user__home_state diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_subdaily_offset_window_metric__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_subdaily_offset_window_metric__plan0.sql index 0d5ad10ca..91f6460c8 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_subdaily_offset_window_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/BigQuery/test_subdaily_offset_window_metric__plan0.sql @@ -25,17 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__hour AS metric_time__hour - , DATETIME_TRUNC(subq_2.metric_time__hour, day) AS metric_time__day - , DATETIME_TRUNC(subq_2.metric_time__hour, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_2.metric_time__hour, month) AS metric_time__month - , DATETIME_TRUNC(subq_2.metric_time__hour, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_2.metric_time__hour, year) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__hour) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__hour) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__hour) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__hour) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_2.metric_time__hour) = 1, 7, EXTRACT(dayofweek FROM subq_2.metric_time__hour) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_2.metric_time__hour) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -210,6 +199,17 @@ FROM ( , subq_1.user__archived_at__extract_day AS user__archived_at__extract_day , subq_1.user__archived_at__extract_dow AS user__archived_at__extract_dow , subq_1.user__archived_at__extract_doy AS user__archived_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.user AS user , subq_1.home_state AS home_state , subq_1.user__home_state AS user__home_state diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0.sql index c068eb504..586021ce5 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_date_part__plan0.sql @@ -245,17 +245,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy + EXTRACT(DAYOFWEEK_ISO FROM subq_7.metric_time__day) AS metric_time__extract_dow , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__day AS metric_time__day + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_subdaily_offset_to_grain_metric__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_subdaily_offset_to_grain_metric__plan0.sql index 5a98cbfc6..bf9e66ea8 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_subdaily_offset_to_grain_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_subdaily_offset_to_grain_metric__plan0.sql @@ -25,17 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__hour AS metric_time__hour - , DATE_TRUNC('day', subq_2.metric_time__hour) AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__hour) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__hour) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__hour) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__hour) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__hour) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__hour) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__hour) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__hour) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_2.metric_time__hour) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__hour) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -210,6 +199,17 @@ FROM ( , subq_1.user__archived_at__extract_day AS user__archived_at__extract_day , subq_1.user__archived_at__extract_dow AS user__archived_at__extract_dow , subq_1.user__archived_at__extract_doy AS user__archived_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.user AS user , subq_1.home_state AS home_state , subq_1.user__home_state AS user__home_state diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_subdaily_offset_window_metric__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_subdaily_offset_window_metric__plan0.sql index e387ad907..097b13f08 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_subdaily_offset_window_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Databricks/test_subdaily_offset_window_metric__plan0.sql @@ -25,17 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__hour AS metric_time__hour - , DATE_TRUNC('day', subq_2.metric_time__hour) AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__hour) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__hour) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__hour) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__hour) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__hour) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__hour) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__hour) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__hour) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_2.metric_time__hour) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__hour) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -210,6 +199,17 @@ FROM ( , subq_1.user__archived_at__extract_day AS user__archived_at__extract_day , subq_1.user__archived_at__extract_dow AS user__archived_at__extract_dow , subq_1.user__archived_at__extract_doy AS user__archived_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.user AS user , subq_1.home_state AS home_state , subq_1.user__home_state AS user__home_state diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0.sql index ac7f40a37..4ca895161 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_date_part__plan0.sql @@ -245,17 +245,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy + EXTRACT(isodow FROM subq_7.metric_time__day) AS metric_time__extract_dow , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__day AS metric_time__day + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_subdaily_offset_to_grain_metric__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_subdaily_offset_to_grain_metric__plan0.sql index b526a04bc..baf5f23c4 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_subdaily_offset_to_grain_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_subdaily_offset_to_grain_metric__plan0.sql @@ -25,17 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__hour AS metric_time__hour - , DATE_TRUNC('day', subq_2.metric_time__hour) AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__hour) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__hour) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__hour) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__hour) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__hour) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__hour) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__hour) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__hour) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__hour) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__hour) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -210,6 +199,17 @@ FROM ( , subq_1.user__archived_at__extract_day AS user__archived_at__extract_day , subq_1.user__archived_at__extract_dow AS user__archived_at__extract_dow , subq_1.user__archived_at__extract_doy AS user__archived_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.user AS user , subq_1.home_state AS home_state , subq_1.user__home_state AS user__home_state diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_subdaily_offset_window_metric__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_subdaily_offset_window_metric__plan0.sql index 22151fa06..30423607d 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_subdaily_offset_window_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/DuckDB/test_subdaily_offset_window_metric__plan0.sql @@ -25,17 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__hour AS metric_time__hour - , DATE_TRUNC('day', subq_2.metric_time__hour) AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__hour) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__hour) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__hour) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__hour) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__hour) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__hour) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__hour) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__hour) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__hour) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__hour) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -210,6 +199,17 @@ FROM ( , subq_1.user__archived_at__extract_day AS user__archived_at__extract_day , subq_1.user__archived_at__extract_dow AS user__archived_at__extract_dow , subq_1.user__archived_at__extract_doy AS user__archived_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.user AS user , subq_1.home_state AS home_state , subq_1.user__home_state AS user__home_state diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0.sql index 32bcbd547..863920537 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_date_part__plan0.sql @@ -245,17 +245,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy + EXTRACT(isodow FROM subq_7.metric_time__day) AS metric_time__extract_dow , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__day AS metric_time__day + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_subdaily_offset_to_grain_metric__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_subdaily_offset_to_grain_metric__plan0.sql index c78bda1e0..4a4aa1d5d 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_subdaily_offset_to_grain_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_subdaily_offset_to_grain_metric__plan0.sql @@ -25,17 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__hour AS metric_time__hour - , DATE_TRUNC('day', subq_2.metric_time__hour) AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__hour) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__hour) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__hour) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__hour) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__hour) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__hour) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__hour) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__hour) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__hour) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__hour) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -210,6 +199,17 @@ FROM ( , subq_1.user__archived_at__extract_day AS user__archived_at__extract_day , subq_1.user__archived_at__extract_dow AS user__archived_at__extract_dow , subq_1.user__archived_at__extract_doy AS user__archived_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.user AS user , subq_1.home_state AS home_state , subq_1.user__home_state AS user__home_state diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_subdaily_offset_window_metric__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_subdaily_offset_window_metric__plan0.sql index fa73c87f4..15163da5a 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_subdaily_offset_window_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Postgres/test_subdaily_offset_window_metric__plan0.sql @@ -25,17 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__hour AS metric_time__hour - , DATE_TRUNC('day', subq_2.metric_time__hour) AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__hour) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__hour) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__hour) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__hour) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__hour) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__hour) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__hour) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__hour) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_2.metric_time__hour) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__hour) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -210,6 +199,17 @@ FROM ( , subq_1.user__archived_at__extract_day AS user__archived_at__extract_day , subq_1.user__archived_at__extract_dow AS user__archived_at__extract_dow , subq_1.user__archived_at__extract_doy AS user__archived_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.user AS user , subq_1.home_state AS home_state , subq_1.user__home_state AS user__home_state diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0.sql index a23d8fe08..084b29ac9 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_offset_window_with_date_part__plan0.sql @@ -245,17 +245,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_7.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_7.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_7.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy + CASE WHEN EXTRACT(dow FROM subq_7.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_7.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_7.metric_time__day) END AS metric_time__extract_dow , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__day AS metric_time__day + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_subdaily_offset_to_grain_metric__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_subdaily_offset_to_grain_metric__plan0.sql index 9dd587159..60c1045d2 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_subdaily_offset_to_grain_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_subdaily_offset_to_grain_metric__plan0.sql @@ -25,17 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__hour AS metric_time__hour - , DATE_TRUNC('day', subq_2.metric_time__hour) AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__hour) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__hour) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__hour) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__hour) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__hour) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__hour) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__hour) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__hour) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_2.metric_time__hour) = 0 THEN EXTRACT(dow FROM subq_2.metric_time__hour) + 7 ELSE EXTRACT(dow FROM subq_2.metric_time__hour) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__hour) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -210,6 +199,17 @@ FROM ( , subq_1.user__archived_at__extract_day AS user__archived_at__extract_day , subq_1.user__archived_at__extract_dow AS user__archived_at__extract_dow , subq_1.user__archived_at__extract_doy AS user__archived_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.user AS user , subq_1.home_state AS home_state , subq_1.user__home_state AS user__home_state diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_subdaily_offset_window_metric__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_subdaily_offset_window_metric__plan0.sql index 408983c56..53c91fdce 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_subdaily_offset_window_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Redshift/test_subdaily_offset_window_metric__plan0.sql @@ -25,17 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__hour AS metric_time__hour - , DATE_TRUNC('day', subq_2.metric_time__hour) AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__hour) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__hour) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__hour) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__hour) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__hour) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__hour) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__hour) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__hour) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_2.metric_time__hour) = 0 THEN EXTRACT(dow FROM subq_2.metric_time__hour) + 7 ELSE EXTRACT(dow FROM subq_2.metric_time__hour) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__hour) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -210,6 +199,17 @@ FROM ( , subq_1.user__archived_at__extract_day AS user__archived_at__extract_day , subq_1.user__archived_at__extract_dow AS user__archived_at__extract_dow , subq_1.user__archived_at__extract_doy AS user__archived_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.user AS user , subq_1.home_state AS home_state , subq_1.user__home_state AS user__home_state diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0.sql index 10c17d8dc..a5bfbf746 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_offset_window_with_date_part__plan0.sql @@ -245,17 +245,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy + EXTRACT(dayofweekiso FROM subq_7.metric_time__day) AS metric_time__extract_dow , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__day AS metric_time__day + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_subdaily_offset_to_grain_metric__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_subdaily_offset_to_grain_metric__plan0.sql index 96980f433..e4e795f63 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_subdaily_offset_to_grain_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_subdaily_offset_to_grain_metric__plan0.sql @@ -25,17 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__hour AS metric_time__hour - , DATE_TRUNC('day', subq_2.metric_time__hour) AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__hour) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__hour) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__hour) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__hour) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__hour) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__hour) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__hour) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__hour) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_2.metric_time__hour) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__hour) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -210,6 +199,17 @@ FROM ( , subq_1.user__archived_at__extract_day AS user__archived_at__extract_day , subq_1.user__archived_at__extract_dow AS user__archived_at__extract_dow , subq_1.user__archived_at__extract_doy AS user__archived_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.user AS user , subq_1.home_state AS home_state , subq_1.user__home_state AS user__home_state diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_subdaily_offset_window_metric__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_subdaily_offset_window_metric__plan0.sql index ea392fffb..23890bb35 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_subdaily_offset_window_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Snowflake/test_subdaily_offset_window_metric__plan0.sql @@ -25,17 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__hour AS metric_time__hour - , DATE_TRUNC('day', subq_2.metric_time__hour) AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__hour) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__hour) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__hour) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__hour) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__hour) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__hour) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__hour) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__hour) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_2.metric_time__hour) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__hour) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -210,6 +199,17 @@ FROM ( , subq_1.user__archived_at__extract_day AS user__archived_at__extract_day , subq_1.user__archived_at__extract_dow AS user__archived_at__extract_dow , subq_1.user__archived_at__extract_doy AS user__archived_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.user AS user , subq_1.home_state AS home_state , subq_1.user__home_state AS user__home_state diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_date_part__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_date_part__plan0.sql index adf84a41b..6a982eb19 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_date_part__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_offset_window_with_date_part__plan0.sql @@ -245,17 +245,7 @@ FROM ( FROM ( -- Join to Time Spine Dataset SELECT - subq_7.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_7.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_7.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_7.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_7.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_7.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_7.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_7.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_7.metric_time__day) AS metric_time__extract_doy + EXTRACT(DAY_OF_WEEK FROM subq_7.metric_time__day) AS metric_time__extract_dow , subq_6.ds__day AS ds__day , subq_6.ds__week AS ds__week , subq_6.ds__month AS ds__month @@ -322,6 +312,16 @@ FROM ( , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_6.metric_time__day AS metric_time__day + , subq_6.metric_time__week AS metric_time__week + , subq_6.metric_time__month AS metric_time__month + , subq_6.metric_time__quarter AS metric_time__quarter + , subq_6.metric_time__year AS metric_time__year + , subq_6.metric_time__extract_year AS metric_time__extract_year + , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_6.metric_time__extract_month AS metric_time__extract_month + , subq_6.metric_time__extract_day AS metric_time__extract_day + , subq_6.metric_time__extract_doy AS metric_time__extract_doy , subq_6.listing AS listing , subq_6.guest AS guest , subq_6.host AS host diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_subdaily_offset_to_grain_metric__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_subdaily_offset_to_grain_metric__plan0.sql index d60b3bac0..74b767a3c 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_subdaily_offset_to_grain_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_subdaily_offset_to_grain_metric__plan0.sql @@ -25,17 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__hour AS metric_time__hour - , DATE_TRUNC('day', subq_2.metric_time__hour) AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__hour) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__hour) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__hour) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__hour) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__hour) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__hour) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__hour) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__hour) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_2.metric_time__hour) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__hour) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -210,6 +199,17 @@ FROM ( , subq_1.user__archived_at__extract_day AS user__archived_at__extract_day , subq_1.user__archived_at__extract_dow AS user__archived_at__extract_dow , subq_1.user__archived_at__extract_doy AS user__archived_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.user AS user , subq_1.home_state AS home_state , subq_1.user__home_state AS user__home_state diff --git a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_subdaily_offset_window_metric__plan0.sql b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_subdaily_offset_window_metric__plan0.sql index 8a7f7a0b1..384799b70 100644 --- a/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_subdaily_offset_window_metric__plan0.sql +++ b/tests_metricflow/snapshots/test_granularity_date_part_rendering.py/SqlQueryPlan/Trino/test_subdaily_offset_window_metric__plan0.sql @@ -25,17 +25,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_2.metric_time__hour AS metric_time__hour - , DATE_TRUNC('day', subq_2.metric_time__hour) AS metric_time__day - , DATE_TRUNC('week', subq_2.metric_time__hour) AS metric_time__week - , DATE_TRUNC('month', subq_2.metric_time__hour) AS metric_time__month - , DATE_TRUNC('quarter', subq_2.metric_time__hour) AS metric_time__quarter - , DATE_TRUNC('year', subq_2.metric_time__hour) AS metric_time__year - , EXTRACT(year FROM subq_2.metric_time__hour) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_2.metric_time__hour) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_2.metric_time__hour) AS metric_time__extract_month - , EXTRACT(day FROM subq_2.metric_time__hour) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_2.metric_time__hour) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_2.metric_time__hour) AS metric_time__extract_doy , subq_1.ds__day AS ds__day , subq_1.ds__week AS ds__week , subq_1.ds__month AS ds__month @@ -210,6 +199,17 @@ FROM ( , subq_1.user__archived_at__extract_day AS user__archived_at__extract_day , subq_1.user__archived_at__extract_dow AS user__archived_at__extract_dow , subq_1.user__archived_at__extract_doy AS user__archived_at__extract_doy + , subq_1.metric_time__day AS metric_time__day + , subq_1.metric_time__week AS metric_time__week + , subq_1.metric_time__month AS metric_time__month + , subq_1.metric_time__quarter AS metric_time__quarter + , subq_1.metric_time__year AS metric_time__year + , subq_1.metric_time__extract_year AS metric_time__extract_year + , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_1.metric_time__extract_month AS metric_time__extract_month + , subq_1.metric_time__extract_day AS metric_time__extract_day + , subq_1.metric_time__extract_dow AS metric_time__extract_dow + , subq_1.metric_time__extract_doy AS metric_time__extract_doy , subq_1.user AS user , subq_1.home_state AS home_state , subq_1.user__home_state AS user__home_state diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql index 64f3776b5..393782f27 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql @@ -633,16 +633,6 @@ FROM ( -- Constrain Output with WHERE SELECT subq_21.metric_time__day - , subq_21.metric_time__week - , subq_21.metric_time__month - , subq_21.metric_time__quarter - , subq_21.metric_time__year - , subq_21.metric_time__extract_year - , subq_21.metric_time__extract_quarter - , subq_21.metric_time__extract_month - , subq_21.metric_time__extract_day - , subq_21.metric_time__extract_dow - , subq_21.metric_time__extract_doy , subq_21.ds__day , subq_21.ds__week , subq_21.ds__month @@ -709,6 +699,16 @@ FROM ( , subq_21.booking__paid_at__extract_day , subq_21.booking__paid_at__extract_dow , subq_21.booking__paid_at__extract_doy + , subq_21.metric_time__week + , subq_21.metric_time__month + , subq_21.metric_time__quarter + , subq_21.metric_time__year + , subq_21.metric_time__extract_year + , subq_21.metric_time__extract_quarter + , subq_21.metric_time__extract_month + , subq_21.metric_time__extract_day + , subq_21.metric_time__extract_dow + , subq_21.metric_time__extract_doy , subq_21.listing , subq_21.guest , subq_21.host @@ -736,16 +736,6 @@ FROM ( SELECT subq_20.country_latest AS listing__country_latest , subq_17.metric_time__day AS metric_time__day - , subq_17.metric_time__week AS metric_time__week - , subq_17.metric_time__month AS metric_time__month - , subq_17.metric_time__quarter AS metric_time__quarter - , subq_17.metric_time__year AS metric_time__year - , subq_17.metric_time__extract_year AS metric_time__extract_year - , subq_17.metric_time__extract_quarter AS metric_time__extract_quarter - , subq_17.metric_time__extract_month AS metric_time__extract_month - , subq_17.metric_time__extract_day AS metric_time__extract_day - , subq_17.metric_time__extract_dow AS metric_time__extract_dow - , subq_17.metric_time__extract_doy AS metric_time__extract_doy , subq_17.ds__day AS ds__day , subq_17.ds__week AS ds__week , subq_17.ds__month AS ds__month @@ -812,6 +802,16 @@ FROM ( , subq_17.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_17.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_17.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_17.metric_time__week AS metric_time__week + , subq_17.metric_time__month AS metric_time__month + , subq_17.metric_time__quarter AS metric_time__quarter + , subq_17.metric_time__year AS metric_time__year + , subq_17.metric_time__extract_year AS metric_time__extract_year + , subq_17.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_17.metric_time__extract_month AS metric_time__extract_month + , subq_17.metric_time__extract_day AS metric_time__extract_day + , subq_17.metric_time__extract_dow AS metric_time__extract_dow + , subq_17.metric_time__extract_doy AS metric_time__extract_doy , subq_17.listing AS listing , subq_17.guest AS guest , subq_17.host AS host @@ -837,16 +837,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_15.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_15.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_15.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_15.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_15.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_15.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_15.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_15.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_15.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_15.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_15.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_15.metric_time__day) AS metric_time__extract_doy , subq_14.ds__day AS ds__day , subq_14.ds__week AS ds__week , subq_14.ds__month AS ds__month @@ -913,6 +903,16 @@ FROM ( , subq_14.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_14.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_14.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_14.metric_time__week AS metric_time__week + , subq_14.metric_time__month AS metric_time__month + , subq_14.metric_time__quarter AS metric_time__quarter + , subq_14.metric_time__year AS metric_time__year + , subq_14.metric_time__extract_year AS metric_time__extract_year + , subq_14.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_14.metric_time__extract_month AS metric_time__extract_month + , subq_14.metric_time__extract_day AS metric_time__extract_day + , subq_14.metric_time__extract_dow AS metric_time__extract_dow + , subq_14.metric_time__extract_doy AS metric_time__extract_doy , subq_14.listing AS listing , subq_14.guest AS guest , subq_14.host AS host diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_offset_metric_with_query_time_filters__plan0.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_offset_metric_with_query_time_filters__plan0.sql index ad4b73820..d9a3c7f8e 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_offset_metric_with_query_time_filters__plan0.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/BigQuery/test_offset_metric_with_query_time_filters__plan0.sql @@ -606,16 +606,6 @@ FROM ( -- Constrain Output with WHERE SELECT subq_18.metric_time__day - , subq_18.metric_time__week - , subq_18.metric_time__month - , subq_18.metric_time__quarter - , subq_18.metric_time__year - , subq_18.metric_time__extract_year - , subq_18.metric_time__extract_quarter - , subq_18.metric_time__extract_month - , subq_18.metric_time__extract_day - , subq_18.metric_time__extract_dow - , subq_18.metric_time__extract_doy , subq_18.ds__day , subq_18.ds__week , subq_18.ds__month @@ -682,6 +672,16 @@ FROM ( , subq_18.booking__paid_at__extract_day , subq_18.booking__paid_at__extract_dow , subq_18.booking__paid_at__extract_doy + , subq_18.metric_time__week + , subq_18.metric_time__month + , subq_18.metric_time__quarter + , subq_18.metric_time__year + , subq_18.metric_time__extract_year + , subq_18.metric_time__extract_quarter + , subq_18.metric_time__extract_month + , subq_18.metric_time__extract_day + , subq_18.metric_time__extract_dow + , subq_18.metric_time__extract_doy , subq_18.listing , subq_18.guest , subq_18.host @@ -709,16 +709,6 @@ FROM ( SELECT subq_17.country_latest AS listing__country_latest , subq_14.metric_time__day AS metric_time__day - , subq_14.metric_time__week AS metric_time__week - , subq_14.metric_time__month AS metric_time__month - , subq_14.metric_time__quarter AS metric_time__quarter - , subq_14.metric_time__year AS metric_time__year - , subq_14.metric_time__extract_year AS metric_time__extract_year - , subq_14.metric_time__extract_quarter AS metric_time__extract_quarter - , subq_14.metric_time__extract_month AS metric_time__extract_month - , subq_14.metric_time__extract_day AS metric_time__extract_day - , subq_14.metric_time__extract_dow AS metric_time__extract_dow - , subq_14.metric_time__extract_doy AS metric_time__extract_doy , subq_14.ds__day AS ds__day , subq_14.ds__week AS ds__week , subq_14.ds__month AS ds__month @@ -785,6 +775,16 @@ FROM ( , subq_14.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_14.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_14.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_14.metric_time__week AS metric_time__week + , subq_14.metric_time__month AS metric_time__month + , subq_14.metric_time__quarter AS metric_time__quarter + , subq_14.metric_time__year AS metric_time__year + , subq_14.metric_time__extract_year AS metric_time__extract_year + , subq_14.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_14.metric_time__extract_month AS metric_time__extract_month + , subq_14.metric_time__extract_day AS metric_time__extract_day + , subq_14.metric_time__extract_dow AS metric_time__extract_dow + , subq_14.metric_time__extract_doy AS metric_time__extract_doy , subq_14.listing AS listing , subq_14.guest AS guest , subq_14.host AS host @@ -810,16 +810,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_12.metric_time__day AS metric_time__day - , DATETIME_TRUNC(subq_12.metric_time__day, isoweek) AS metric_time__week - , DATETIME_TRUNC(subq_12.metric_time__day, month) AS metric_time__month - , DATETIME_TRUNC(subq_12.metric_time__day, quarter) AS metric_time__quarter - , DATETIME_TRUNC(subq_12.metric_time__day, year) AS metric_time__year - , EXTRACT(year FROM subq_12.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_12.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_12.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_12.metric_time__day) AS metric_time__extract_day - , IF(EXTRACT(dayofweek FROM subq_12.metric_time__day) = 1, 7, EXTRACT(dayofweek FROM subq_12.metric_time__day) - 1) AS metric_time__extract_dow - , EXTRACT(dayofyear FROM subq_12.metric_time__day) AS metric_time__extract_doy , subq_11.ds__day AS ds__day , subq_11.ds__week AS ds__week , subq_11.ds__month AS ds__month @@ -886,6 +876,16 @@ FROM ( , subq_11.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_11.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_11.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_11.metric_time__week AS metric_time__week + , subq_11.metric_time__month AS metric_time__month + , subq_11.metric_time__quarter AS metric_time__quarter + , subq_11.metric_time__year AS metric_time__year + , subq_11.metric_time__extract_year AS metric_time__extract_year + , subq_11.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_11.metric_time__extract_month AS metric_time__extract_month + , subq_11.metric_time__extract_day AS metric_time__extract_day + , subq_11.metric_time__extract_dow AS metric_time__extract_dow + , subq_11.metric_time__extract_doy AS metric_time__extract_doy , subq_11.listing AS listing , subq_11.guest AS guest , subq_11.host AS host diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql index a31c378f6..8ca173f41 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql @@ -633,16 +633,6 @@ FROM ( -- Constrain Output with WHERE SELECT subq_21.metric_time__day - , subq_21.metric_time__week - , subq_21.metric_time__month - , subq_21.metric_time__quarter - , subq_21.metric_time__year - , subq_21.metric_time__extract_year - , subq_21.metric_time__extract_quarter - , subq_21.metric_time__extract_month - , subq_21.metric_time__extract_day - , subq_21.metric_time__extract_dow - , subq_21.metric_time__extract_doy , subq_21.ds__day , subq_21.ds__week , subq_21.ds__month @@ -709,6 +699,16 @@ FROM ( , subq_21.booking__paid_at__extract_day , subq_21.booking__paid_at__extract_dow , subq_21.booking__paid_at__extract_doy + , subq_21.metric_time__week + , subq_21.metric_time__month + , subq_21.metric_time__quarter + , subq_21.metric_time__year + , subq_21.metric_time__extract_year + , subq_21.metric_time__extract_quarter + , subq_21.metric_time__extract_month + , subq_21.metric_time__extract_day + , subq_21.metric_time__extract_dow + , subq_21.metric_time__extract_doy , subq_21.listing , subq_21.guest , subq_21.host @@ -736,16 +736,6 @@ FROM ( SELECT subq_20.country_latest AS listing__country_latest , subq_17.metric_time__day AS metric_time__day - , subq_17.metric_time__week AS metric_time__week - , subq_17.metric_time__month AS metric_time__month - , subq_17.metric_time__quarter AS metric_time__quarter - , subq_17.metric_time__year AS metric_time__year - , subq_17.metric_time__extract_year AS metric_time__extract_year - , subq_17.metric_time__extract_quarter AS metric_time__extract_quarter - , subq_17.metric_time__extract_month AS metric_time__extract_month - , subq_17.metric_time__extract_day AS metric_time__extract_day - , subq_17.metric_time__extract_dow AS metric_time__extract_dow - , subq_17.metric_time__extract_doy AS metric_time__extract_doy , subq_17.ds__day AS ds__day , subq_17.ds__week AS ds__week , subq_17.ds__month AS ds__month @@ -812,6 +802,16 @@ FROM ( , subq_17.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_17.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_17.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_17.metric_time__week AS metric_time__week + , subq_17.metric_time__month AS metric_time__month + , subq_17.metric_time__quarter AS metric_time__quarter + , subq_17.metric_time__year AS metric_time__year + , subq_17.metric_time__extract_year AS metric_time__extract_year + , subq_17.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_17.metric_time__extract_month AS metric_time__extract_month + , subq_17.metric_time__extract_day AS metric_time__extract_day + , subq_17.metric_time__extract_dow AS metric_time__extract_dow + , subq_17.metric_time__extract_doy AS metric_time__extract_doy , subq_17.listing AS listing , subq_17.guest AS guest , subq_17.host AS host @@ -837,16 +837,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_15.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_15.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_15.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_15.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_15.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_15.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_15.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_15.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_15.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_15.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_15.metric_time__day) AS metric_time__extract_doy , subq_14.ds__day AS ds__day , subq_14.ds__week AS ds__week , subq_14.ds__month AS ds__month @@ -913,6 +903,16 @@ FROM ( , subq_14.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_14.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_14.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_14.metric_time__week AS metric_time__week + , subq_14.metric_time__month AS metric_time__month + , subq_14.metric_time__quarter AS metric_time__quarter + , subq_14.metric_time__year AS metric_time__year + , subq_14.metric_time__extract_year AS metric_time__extract_year + , subq_14.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_14.metric_time__extract_month AS metric_time__extract_month + , subq_14.metric_time__extract_day AS metric_time__extract_day + , subq_14.metric_time__extract_dow AS metric_time__extract_dow + , subq_14.metric_time__extract_doy AS metric_time__extract_doy , subq_14.listing AS listing , subq_14.guest AS guest , subq_14.host AS host diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_offset_metric_with_query_time_filters__plan0.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_offset_metric_with_query_time_filters__plan0.sql index fc5c44e96..b41872c4c 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_offset_metric_with_query_time_filters__plan0.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Databricks/test_offset_metric_with_query_time_filters__plan0.sql @@ -606,16 +606,6 @@ FROM ( -- Constrain Output with WHERE SELECT subq_18.metric_time__day - , subq_18.metric_time__week - , subq_18.metric_time__month - , subq_18.metric_time__quarter - , subq_18.metric_time__year - , subq_18.metric_time__extract_year - , subq_18.metric_time__extract_quarter - , subq_18.metric_time__extract_month - , subq_18.metric_time__extract_day - , subq_18.metric_time__extract_dow - , subq_18.metric_time__extract_doy , subq_18.ds__day , subq_18.ds__week , subq_18.ds__month @@ -682,6 +672,16 @@ FROM ( , subq_18.booking__paid_at__extract_day , subq_18.booking__paid_at__extract_dow , subq_18.booking__paid_at__extract_doy + , subq_18.metric_time__week + , subq_18.metric_time__month + , subq_18.metric_time__quarter + , subq_18.metric_time__year + , subq_18.metric_time__extract_year + , subq_18.metric_time__extract_quarter + , subq_18.metric_time__extract_month + , subq_18.metric_time__extract_day + , subq_18.metric_time__extract_dow + , subq_18.metric_time__extract_doy , subq_18.listing , subq_18.guest , subq_18.host @@ -709,16 +709,6 @@ FROM ( SELECT subq_17.country_latest AS listing__country_latest , subq_14.metric_time__day AS metric_time__day - , subq_14.metric_time__week AS metric_time__week - , subq_14.metric_time__month AS metric_time__month - , subq_14.metric_time__quarter AS metric_time__quarter - , subq_14.metric_time__year AS metric_time__year - , subq_14.metric_time__extract_year AS metric_time__extract_year - , subq_14.metric_time__extract_quarter AS metric_time__extract_quarter - , subq_14.metric_time__extract_month AS metric_time__extract_month - , subq_14.metric_time__extract_day AS metric_time__extract_day - , subq_14.metric_time__extract_dow AS metric_time__extract_dow - , subq_14.metric_time__extract_doy AS metric_time__extract_doy , subq_14.ds__day AS ds__day , subq_14.ds__week AS ds__week , subq_14.ds__month AS ds__month @@ -785,6 +775,16 @@ FROM ( , subq_14.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_14.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_14.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_14.metric_time__week AS metric_time__week + , subq_14.metric_time__month AS metric_time__month + , subq_14.metric_time__quarter AS metric_time__quarter + , subq_14.metric_time__year AS metric_time__year + , subq_14.metric_time__extract_year AS metric_time__extract_year + , subq_14.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_14.metric_time__extract_month AS metric_time__extract_month + , subq_14.metric_time__extract_day AS metric_time__extract_day + , subq_14.metric_time__extract_dow AS metric_time__extract_dow + , subq_14.metric_time__extract_doy AS metric_time__extract_doy , subq_14.listing AS listing , subq_14.guest AS guest , subq_14.host AS host @@ -810,16 +810,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_12.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_12.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_12.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_12.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_12.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_12.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_12.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_12.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_12.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAYOFWEEK_ISO FROM subq_12.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_12.metric_time__day) AS metric_time__extract_doy , subq_11.ds__day AS ds__day , subq_11.ds__week AS ds__week , subq_11.ds__month AS ds__month @@ -886,6 +876,16 @@ FROM ( , subq_11.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_11.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_11.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_11.metric_time__week AS metric_time__week + , subq_11.metric_time__month AS metric_time__month + , subq_11.metric_time__quarter AS metric_time__quarter + , subq_11.metric_time__year AS metric_time__year + , subq_11.metric_time__extract_year AS metric_time__extract_year + , subq_11.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_11.metric_time__extract_month AS metric_time__extract_month + , subq_11.metric_time__extract_day AS metric_time__extract_day + , subq_11.metric_time__extract_dow AS metric_time__extract_dow + , subq_11.metric_time__extract_doy AS metric_time__extract_doy , subq_11.listing AS listing , subq_11.guest AS guest , subq_11.host AS host 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 64e091427..8d4452f3b 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 @@ -633,16 +633,6 @@ FROM ( -- Constrain Output with WHERE SELECT subq_21.metric_time__day - , subq_21.metric_time__week - , subq_21.metric_time__month - , subq_21.metric_time__quarter - , subq_21.metric_time__year - , subq_21.metric_time__extract_year - , subq_21.metric_time__extract_quarter - , subq_21.metric_time__extract_month - , subq_21.metric_time__extract_day - , subq_21.metric_time__extract_dow - , subq_21.metric_time__extract_doy , subq_21.ds__day , subq_21.ds__week , subq_21.ds__month @@ -709,6 +699,16 @@ FROM ( , subq_21.booking__paid_at__extract_day , subq_21.booking__paid_at__extract_dow , subq_21.booking__paid_at__extract_doy + , subq_21.metric_time__week + , subq_21.metric_time__month + , subq_21.metric_time__quarter + , subq_21.metric_time__year + , subq_21.metric_time__extract_year + , subq_21.metric_time__extract_quarter + , subq_21.metric_time__extract_month + , subq_21.metric_time__extract_day + , subq_21.metric_time__extract_dow + , subq_21.metric_time__extract_doy , subq_21.listing , subq_21.guest , subq_21.host @@ -736,16 +736,6 @@ FROM ( SELECT subq_20.country_latest AS listing__country_latest , subq_17.metric_time__day AS metric_time__day - , subq_17.metric_time__week AS metric_time__week - , subq_17.metric_time__month AS metric_time__month - , subq_17.metric_time__quarter AS metric_time__quarter - , subq_17.metric_time__year AS metric_time__year - , subq_17.metric_time__extract_year AS metric_time__extract_year - , subq_17.metric_time__extract_quarter AS metric_time__extract_quarter - , subq_17.metric_time__extract_month AS metric_time__extract_month - , subq_17.metric_time__extract_day AS metric_time__extract_day - , subq_17.metric_time__extract_dow AS metric_time__extract_dow - , subq_17.metric_time__extract_doy AS metric_time__extract_doy , subq_17.ds__day AS ds__day , subq_17.ds__week AS ds__week , subq_17.ds__month AS ds__month @@ -812,6 +802,16 @@ FROM ( , subq_17.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_17.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_17.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_17.metric_time__week AS metric_time__week + , subq_17.metric_time__month AS metric_time__month + , subq_17.metric_time__quarter AS metric_time__quarter + , subq_17.metric_time__year AS metric_time__year + , subq_17.metric_time__extract_year AS metric_time__extract_year + , subq_17.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_17.metric_time__extract_month AS metric_time__extract_month + , subq_17.metric_time__extract_day AS metric_time__extract_day + , subq_17.metric_time__extract_dow AS metric_time__extract_dow + , subq_17.metric_time__extract_doy AS metric_time__extract_doy , subq_17.listing AS listing , subq_17.guest AS guest , subq_17.host AS host @@ -837,16 +837,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_15.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_15.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_15.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_15.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_15.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_15.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_15.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_15.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_15.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_15.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_15.metric_time__day) AS metric_time__extract_doy , subq_14.ds__day AS ds__day , subq_14.ds__week AS ds__week , subq_14.ds__month AS ds__month @@ -913,6 +903,16 @@ FROM ( , subq_14.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_14.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_14.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_14.metric_time__week AS metric_time__week + , subq_14.metric_time__month AS metric_time__month + , subq_14.metric_time__quarter AS metric_time__quarter + , subq_14.metric_time__year AS metric_time__year + , subq_14.metric_time__extract_year AS metric_time__extract_year + , subq_14.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_14.metric_time__extract_month AS metric_time__extract_month + , subq_14.metric_time__extract_day AS metric_time__extract_day + , subq_14.metric_time__extract_dow AS metric_time__extract_dow + , subq_14.metric_time__extract_doy AS metric_time__extract_doy , subq_14.listing AS listing , subq_14.guest AS guest , subq_14.host AS host 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 11ed54a07..d6dec9583 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 @@ -606,16 +606,6 @@ FROM ( -- Constrain Output with WHERE SELECT subq_18.metric_time__day - , subq_18.metric_time__week - , subq_18.metric_time__month - , subq_18.metric_time__quarter - , subq_18.metric_time__year - , subq_18.metric_time__extract_year - , subq_18.metric_time__extract_quarter - , subq_18.metric_time__extract_month - , subq_18.metric_time__extract_day - , subq_18.metric_time__extract_dow - , subq_18.metric_time__extract_doy , subq_18.ds__day , subq_18.ds__week , subq_18.ds__month @@ -682,6 +672,16 @@ FROM ( , subq_18.booking__paid_at__extract_day , subq_18.booking__paid_at__extract_dow , subq_18.booking__paid_at__extract_doy + , subq_18.metric_time__week + , subq_18.metric_time__month + , subq_18.metric_time__quarter + , subq_18.metric_time__year + , subq_18.metric_time__extract_year + , subq_18.metric_time__extract_quarter + , subq_18.metric_time__extract_month + , subq_18.metric_time__extract_day + , subq_18.metric_time__extract_dow + , subq_18.metric_time__extract_doy , subq_18.listing , subq_18.guest , subq_18.host @@ -709,16 +709,6 @@ FROM ( SELECT subq_17.country_latest AS listing__country_latest , subq_14.metric_time__day AS metric_time__day - , subq_14.metric_time__week AS metric_time__week - , subq_14.metric_time__month AS metric_time__month - , subq_14.metric_time__quarter AS metric_time__quarter - , subq_14.metric_time__year AS metric_time__year - , subq_14.metric_time__extract_year AS metric_time__extract_year - , subq_14.metric_time__extract_quarter AS metric_time__extract_quarter - , subq_14.metric_time__extract_month AS metric_time__extract_month - , subq_14.metric_time__extract_day AS metric_time__extract_day - , subq_14.metric_time__extract_dow AS metric_time__extract_dow - , subq_14.metric_time__extract_doy AS metric_time__extract_doy , subq_14.ds__day AS ds__day , subq_14.ds__week AS ds__week , subq_14.ds__month AS ds__month @@ -785,6 +775,16 @@ FROM ( , subq_14.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_14.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_14.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_14.metric_time__week AS metric_time__week + , subq_14.metric_time__month AS metric_time__month + , subq_14.metric_time__quarter AS metric_time__quarter + , subq_14.metric_time__year AS metric_time__year + , subq_14.metric_time__extract_year AS metric_time__extract_year + , subq_14.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_14.metric_time__extract_month AS metric_time__extract_month + , subq_14.metric_time__extract_day AS metric_time__extract_day + , subq_14.metric_time__extract_dow AS metric_time__extract_dow + , subq_14.metric_time__extract_doy AS metric_time__extract_doy , subq_14.listing AS listing , subq_14.guest AS guest , subq_14.host AS host @@ -810,16 +810,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_12.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_12.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_12.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_12.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_12.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_12.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_12.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_12.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_12.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_12.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_12.metric_time__day) AS metric_time__extract_doy , subq_11.ds__day AS ds__day , subq_11.ds__week AS ds__week , subq_11.ds__month AS ds__month @@ -886,6 +876,16 @@ FROM ( , subq_11.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_11.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_11.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_11.metric_time__week AS metric_time__week + , subq_11.metric_time__month AS metric_time__month + , subq_11.metric_time__quarter AS metric_time__quarter + , subq_11.metric_time__year AS metric_time__year + , subq_11.metric_time__extract_year AS metric_time__extract_year + , subq_11.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_11.metric_time__extract_month AS metric_time__extract_month + , subq_11.metric_time__extract_day AS metric_time__extract_day + , subq_11.metric_time__extract_dow AS metric_time__extract_dow + , subq_11.metric_time__extract_doy AS metric_time__extract_doy , subq_11.listing AS listing , subq_11.guest AS guest , subq_11.host AS host diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql index b2e5f0ec2..73b0e1ff7 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql @@ -633,16 +633,6 @@ FROM ( -- Constrain Output with WHERE SELECT subq_21.metric_time__day - , subq_21.metric_time__week - , subq_21.metric_time__month - , subq_21.metric_time__quarter - , subq_21.metric_time__year - , subq_21.metric_time__extract_year - , subq_21.metric_time__extract_quarter - , subq_21.metric_time__extract_month - , subq_21.metric_time__extract_day - , subq_21.metric_time__extract_dow - , subq_21.metric_time__extract_doy , subq_21.ds__day , subq_21.ds__week , subq_21.ds__month @@ -709,6 +699,16 @@ FROM ( , subq_21.booking__paid_at__extract_day , subq_21.booking__paid_at__extract_dow , subq_21.booking__paid_at__extract_doy + , subq_21.metric_time__week + , subq_21.metric_time__month + , subq_21.metric_time__quarter + , subq_21.metric_time__year + , subq_21.metric_time__extract_year + , subq_21.metric_time__extract_quarter + , subq_21.metric_time__extract_month + , subq_21.metric_time__extract_day + , subq_21.metric_time__extract_dow + , subq_21.metric_time__extract_doy , subq_21.listing , subq_21.guest , subq_21.host @@ -736,16 +736,6 @@ FROM ( SELECT subq_20.country_latest AS listing__country_latest , subq_17.metric_time__day AS metric_time__day - , subq_17.metric_time__week AS metric_time__week - , subq_17.metric_time__month AS metric_time__month - , subq_17.metric_time__quarter AS metric_time__quarter - , subq_17.metric_time__year AS metric_time__year - , subq_17.metric_time__extract_year AS metric_time__extract_year - , subq_17.metric_time__extract_quarter AS metric_time__extract_quarter - , subq_17.metric_time__extract_month AS metric_time__extract_month - , subq_17.metric_time__extract_day AS metric_time__extract_day - , subq_17.metric_time__extract_dow AS metric_time__extract_dow - , subq_17.metric_time__extract_doy AS metric_time__extract_doy , subq_17.ds__day AS ds__day , subq_17.ds__week AS ds__week , subq_17.ds__month AS ds__month @@ -812,6 +802,16 @@ FROM ( , subq_17.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_17.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_17.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_17.metric_time__week AS metric_time__week + , subq_17.metric_time__month AS metric_time__month + , subq_17.metric_time__quarter AS metric_time__quarter + , subq_17.metric_time__year AS metric_time__year + , subq_17.metric_time__extract_year AS metric_time__extract_year + , subq_17.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_17.metric_time__extract_month AS metric_time__extract_month + , subq_17.metric_time__extract_day AS metric_time__extract_day + , subq_17.metric_time__extract_dow AS metric_time__extract_dow + , subq_17.metric_time__extract_doy AS metric_time__extract_doy , subq_17.listing AS listing , subq_17.guest AS guest , subq_17.host AS host @@ -837,16 +837,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_15.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_15.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_15.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_15.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_15.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_15.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_15.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_15.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_15.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_15.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_15.metric_time__day) AS metric_time__extract_doy , subq_14.ds__day AS ds__day , subq_14.ds__week AS ds__week , subq_14.ds__month AS ds__month @@ -913,6 +903,16 @@ FROM ( , subq_14.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_14.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_14.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_14.metric_time__week AS metric_time__week + , subq_14.metric_time__month AS metric_time__month + , subq_14.metric_time__quarter AS metric_time__quarter + , subq_14.metric_time__year AS metric_time__year + , subq_14.metric_time__extract_year AS metric_time__extract_year + , subq_14.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_14.metric_time__extract_month AS metric_time__extract_month + , subq_14.metric_time__extract_day AS metric_time__extract_day + , subq_14.metric_time__extract_dow AS metric_time__extract_dow + , subq_14.metric_time__extract_doy AS metric_time__extract_doy , subq_14.listing AS listing , subq_14.guest AS guest , subq_14.host AS host diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_offset_metric_with_query_time_filters__plan0.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_offset_metric_with_query_time_filters__plan0.sql index 36e886bb4..5e5ff825b 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_offset_metric_with_query_time_filters__plan0.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Postgres/test_offset_metric_with_query_time_filters__plan0.sql @@ -606,16 +606,6 @@ FROM ( -- Constrain Output with WHERE SELECT subq_18.metric_time__day - , subq_18.metric_time__week - , subq_18.metric_time__month - , subq_18.metric_time__quarter - , subq_18.metric_time__year - , subq_18.metric_time__extract_year - , subq_18.metric_time__extract_quarter - , subq_18.metric_time__extract_month - , subq_18.metric_time__extract_day - , subq_18.metric_time__extract_dow - , subq_18.metric_time__extract_doy , subq_18.ds__day , subq_18.ds__week , subq_18.ds__month @@ -682,6 +672,16 @@ FROM ( , subq_18.booking__paid_at__extract_day , subq_18.booking__paid_at__extract_dow , subq_18.booking__paid_at__extract_doy + , subq_18.metric_time__week + , subq_18.metric_time__month + , subq_18.metric_time__quarter + , subq_18.metric_time__year + , subq_18.metric_time__extract_year + , subq_18.metric_time__extract_quarter + , subq_18.metric_time__extract_month + , subq_18.metric_time__extract_day + , subq_18.metric_time__extract_dow + , subq_18.metric_time__extract_doy , subq_18.listing , subq_18.guest , subq_18.host @@ -709,16 +709,6 @@ FROM ( SELECT subq_17.country_latest AS listing__country_latest , subq_14.metric_time__day AS metric_time__day - , subq_14.metric_time__week AS metric_time__week - , subq_14.metric_time__month AS metric_time__month - , subq_14.metric_time__quarter AS metric_time__quarter - , subq_14.metric_time__year AS metric_time__year - , subq_14.metric_time__extract_year AS metric_time__extract_year - , subq_14.metric_time__extract_quarter AS metric_time__extract_quarter - , subq_14.metric_time__extract_month AS metric_time__extract_month - , subq_14.metric_time__extract_day AS metric_time__extract_day - , subq_14.metric_time__extract_dow AS metric_time__extract_dow - , subq_14.metric_time__extract_doy AS metric_time__extract_doy , subq_14.ds__day AS ds__day , subq_14.ds__week AS ds__week , subq_14.ds__month AS ds__month @@ -785,6 +775,16 @@ FROM ( , subq_14.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_14.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_14.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_14.metric_time__week AS metric_time__week + , subq_14.metric_time__month AS metric_time__month + , subq_14.metric_time__quarter AS metric_time__quarter + , subq_14.metric_time__year AS metric_time__year + , subq_14.metric_time__extract_year AS metric_time__extract_year + , subq_14.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_14.metric_time__extract_month AS metric_time__extract_month + , subq_14.metric_time__extract_day AS metric_time__extract_day + , subq_14.metric_time__extract_dow AS metric_time__extract_dow + , subq_14.metric_time__extract_doy AS metric_time__extract_doy , subq_14.listing AS listing , subq_14.guest AS guest , subq_14.host AS host @@ -810,16 +810,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_12.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_12.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_12.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_12.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_12.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_12.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_12.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_12.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_12.metric_time__day) AS metric_time__extract_day - , EXTRACT(isodow FROM subq_12.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_12.metric_time__day) AS metric_time__extract_doy , subq_11.ds__day AS ds__day , subq_11.ds__week AS ds__week , subq_11.ds__month AS ds__month @@ -886,6 +876,16 @@ FROM ( , subq_11.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_11.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_11.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_11.metric_time__week AS metric_time__week + , subq_11.metric_time__month AS metric_time__month + , subq_11.metric_time__quarter AS metric_time__quarter + , subq_11.metric_time__year AS metric_time__year + , subq_11.metric_time__extract_year AS metric_time__extract_year + , subq_11.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_11.metric_time__extract_month AS metric_time__extract_month + , subq_11.metric_time__extract_day AS metric_time__extract_day + , subq_11.metric_time__extract_dow AS metric_time__extract_dow + , subq_11.metric_time__extract_doy AS metric_time__extract_doy , subq_11.listing AS listing , subq_11.guest AS guest , subq_11.host AS host diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql index 7e3af3962..891ef6bdc 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql @@ -633,16 +633,6 @@ FROM ( -- Constrain Output with WHERE SELECT subq_21.metric_time__day - , subq_21.metric_time__week - , subq_21.metric_time__month - , subq_21.metric_time__quarter - , subq_21.metric_time__year - , subq_21.metric_time__extract_year - , subq_21.metric_time__extract_quarter - , subq_21.metric_time__extract_month - , subq_21.metric_time__extract_day - , subq_21.metric_time__extract_dow - , subq_21.metric_time__extract_doy , subq_21.ds__day , subq_21.ds__week , subq_21.ds__month @@ -709,6 +699,16 @@ FROM ( , subq_21.booking__paid_at__extract_day , subq_21.booking__paid_at__extract_dow , subq_21.booking__paid_at__extract_doy + , subq_21.metric_time__week + , subq_21.metric_time__month + , subq_21.metric_time__quarter + , subq_21.metric_time__year + , subq_21.metric_time__extract_year + , subq_21.metric_time__extract_quarter + , subq_21.metric_time__extract_month + , subq_21.metric_time__extract_day + , subq_21.metric_time__extract_dow + , subq_21.metric_time__extract_doy , subq_21.listing , subq_21.guest , subq_21.host @@ -736,16 +736,6 @@ FROM ( SELECT subq_20.country_latest AS listing__country_latest , subq_17.metric_time__day AS metric_time__day - , subq_17.metric_time__week AS metric_time__week - , subq_17.metric_time__month AS metric_time__month - , subq_17.metric_time__quarter AS metric_time__quarter - , subq_17.metric_time__year AS metric_time__year - , subq_17.metric_time__extract_year AS metric_time__extract_year - , subq_17.metric_time__extract_quarter AS metric_time__extract_quarter - , subq_17.metric_time__extract_month AS metric_time__extract_month - , subq_17.metric_time__extract_day AS metric_time__extract_day - , subq_17.metric_time__extract_dow AS metric_time__extract_dow - , subq_17.metric_time__extract_doy AS metric_time__extract_doy , subq_17.ds__day AS ds__day , subq_17.ds__week AS ds__week , subq_17.ds__month AS ds__month @@ -812,6 +802,16 @@ FROM ( , subq_17.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_17.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_17.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_17.metric_time__week AS metric_time__week + , subq_17.metric_time__month AS metric_time__month + , subq_17.metric_time__quarter AS metric_time__quarter + , subq_17.metric_time__year AS metric_time__year + , subq_17.metric_time__extract_year AS metric_time__extract_year + , subq_17.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_17.metric_time__extract_month AS metric_time__extract_month + , subq_17.metric_time__extract_day AS metric_time__extract_day + , subq_17.metric_time__extract_dow AS metric_time__extract_dow + , subq_17.metric_time__extract_doy AS metric_time__extract_doy , subq_17.listing AS listing , subq_17.guest AS guest , subq_17.host AS host @@ -837,16 +837,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_15.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_15.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_15.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_15.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_15.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_15.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_15.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_15.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_15.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_15.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_15.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_15.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_15.metric_time__day) AS metric_time__extract_doy , subq_14.ds__day AS ds__day , subq_14.ds__week AS ds__week , subq_14.ds__month AS ds__month @@ -913,6 +903,16 @@ FROM ( , subq_14.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_14.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_14.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_14.metric_time__week AS metric_time__week + , subq_14.metric_time__month AS metric_time__month + , subq_14.metric_time__quarter AS metric_time__quarter + , subq_14.metric_time__year AS metric_time__year + , subq_14.metric_time__extract_year AS metric_time__extract_year + , subq_14.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_14.metric_time__extract_month AS metric_time__extract_month + , subq_14.metric_time__extract_day AS metric_time__extract_day + , subq_14.metric_time__extract_dow AS metric_time__extract_dow + , subq_14.metric_time__extract_doy AS metric_time__extract_doy , subq_14.listing AS listing , subq_14.guest AS guest , subq_14.host AS host diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_offset_metric_with_query_time_filters__plan0.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_offset_metric_with_query_time_filters__plan0.sql index 2eda004d9..89dfe569d 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_offset_metric_with_query_time_filters__plan0.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Redshift/test_offset_metric_with_query_time_filters__plan0.sql @@ -606,16 +606,6 @@ FROM ( -- Constrain Output with WHERE SELECT subq_18.metric_time__day - , subq_18.metric_time__week - , subq_18.metric_time__month - , subq_18.metric_time__quarter - , subq_18.metric_time__year - , subq_18.metric_time__extract_year - , subq_18.metric_time__extract_quarter - , subq_18.metric_time__extract_month - , subq_18.metric_time__extract_day - , subq_18.metric_time__extract_dow - , subq_18.metric_time__extract_doy , subq_18.ds__day , subq_18.ds__week , subq_18.ds__month @@ -682,6 +672,16 @@ FROM ( , subq_18.booking__paid_at__extract_day , subq_18.booking__paid_at__extract_dow , subq_18.booking__paid_at__extract_doy + , subq_18.metric_time__week + , subq_18.metric_time__month + , subq_18.metric_time__quarter + , subq_18.metric_time__year + , subq_18.metric_time__extract_year + , subq_18.metric_time__extract_quarter + , subq_18.metric_time__extract_month + , subq_18.metric_time__extract_day + , subq_18.metric_time__extract_dow + , subq_18.metric_time__extract_doy , subq_18.listing , subq_18.guest , subq_18.host @@ -709,16 +709,6 @@ FROM ( SELECT subq_17.country_latest AS listing__country_latest , subq_14.metric_time__day AS metric_time__day - , subq_14.metric_time__week AS metric_time__week - , subq_14.metric_time__month AS metric_time__month - , subq_14.metric_time__quarter AS metric_time__quarter - , subq_14.metric_time__year AS metric_time__year - , subq_14.metric_time__extract_year AS metric_time__extract_year - , subq_14.metric_time__extract_quarter AS metric_time__extract_quarter - , subq_14.metric_time__extract_month AS metric_time__extract_month - , subq_14.metric_time__extract_day AS metric_time__extract_day - , subq_14.metric_time__extract_dow AS metric_time__extract_dow - , subq_14.metric_time__extract_doy AS metric_time__extract_doy , subq_14.ds__day AS ds__day , subq_14.ds__week AS ds__week , subq_14.ds__month AS ds__month @@ -785,6 +775,16 @@ FROM ( , subq_14.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_14.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_14.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_14.metric_time__week AS metric_time__week + , subq_14.metric_time__month AS metric_time__month + , subq_14.metric_time__quarter AS metric_time__quarter + , subq_14.metric_time__year AS metric_time__year + , subq_14.metric_time__extract_year AS metric_time__extract_year + , subq_14.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_14.metric_time__extract_month AS metric_time__extract_month + , subq_14.metric_time__extract_day AS metric_time__extract_day + , subq_14.metric_time__extract_dow AS metric_time__extract_dow + , subq_14.metric_time__extract_doy AS metric_time__extract_doy , subq_14.listing AS listing , subq_14.guest AS guest , subq_14.host AS host @@ -810,16 +810,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_12.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_12.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_12.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_12.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_12.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_12.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_12.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_12.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_12.metric_time__day) AS metric_time__extract_day - , CASE WHEN EXTRACT(dow FROM subq_12.metric_time__day) = 0 THEN EXTRACT(dow FROM subq_12.metric_time__day) + 7 ELSE EXTRACT(dow FROM subq_12.metric_time__day) END AS metric_time__extract_dow - , EXTRACT(doy FROM subq_12.metric_time__day) AS metric_time__extract_doy , subq_11.ds__day AS ds__day , subq_11.ds__week AS ds__week , subq_11.ds__month AS ds__month @@ -886,6 +876,16 @@ FROM ( , subq_11.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_11.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_11.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_11.metric_time__week AS metric_time__week + , subq_11.metric_time__month AS metric_time__month + , subq_11.metric_time__quarter AS metric_time__quarter + , subq_11.metric_time__year AS metric_time__year + , subq_11.metric_time__extract_year AS metric_time__extract_year + , subq_11.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_11.metric_time__extract_month AS metric_time__extract_month + , subq_11.metric_time__extract_day AS metric_time__extract_day + , subq_11.metric_time__extract_dow AS metric_time__extract_dow + , subq_11.metric_time__extract_doy AS metric_time__extract_doy , subq_11.listing AS listing , subq_11.guest AS guest , subq_11.host AS host diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql index 3d1cc0484..a8c53b115 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql @@ -633,16 +633,6 @@ FROM ( -- Constrain Output with WHERE SELECT subq_21.metric_time__day - , subq_21.metric_time__week - , subq_21.metric_time__month - , subq_21.metric_time__quarter - , subq_21.metric_time__year - , subq_21.metric_time__extract_year - , subq_21.metric_time__extract_quarter - , subq_21.metric_time__extract_month - , subq_21.metric_time__extract_day - , subq_21.metric_time__extract_dow - , subq_21.metric_time__extract_doy , subq_21.ds__day , subq_21.ds__week , subq_21.ds__month @@ -709,6 +699,16 @@ FROM ( , subq_21.booking__paid_at__extract_day , subq_21.booking__paid_at__extract_dow , subq_21.booking__paid_at__extract_doy + , subq_21.metric_time__week + , subq_21.metric_time__month + , subq_21.metric_time__quarter + , subq_21.metric_time__year + , subq_21.metric_time__extract_year + , subq_21.metric_time__extract_quarter + , subq_21.metric_time__extract_month + , subq_21.metric_time__extract_day + , subq_21.metric_time__extract_dow + , subq_21.metric_time__extract_doy , subq_21.listing , subq_21.guest , subq_21.host @@ -736,16 +736,6 @@ FROM ( SELECT subq_20.country_latest AS listing__country_latest , subq_17.metric_time__day AS metric_time__day - , subq_17.metric_time__week AS metric_time__week - , subq_17.metric_time__month AS metric_time__month - , subq_17.metric_time__quarter AS metric_time__quarter - , subq_17.metric_time__year AS metric_time__year - , subq_17.metric_time__extract_year AS metric_time__extract_year - , subq_17.metric_time__extract_quarter AS metric_time__extract_quarter - , subq_17.metric_time__extract_month AS metric_time__extract_month - , subq_17.metric_time__extract_day AS metric_time__extract_day - , subq_17.metric_time__extract_dow AS metric_time__extract_dow - , subq_17.metric_time__extract_doy AS metric_time__extract_doy , subq_17.ds__day AS ds__day , subq_17.ds__week AS ds__week , subq_17.ds__month AS ds__month @@ -812,6 +802,16 @@ FROM ( , subq_17.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_17.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_17.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_17.metric_time__week AS metric_time__week + , subq_17.metric_time__month AS metric_time__month + , subq_17.metric_time__quarter AS metric_time__quarter + , subq_17.metric_time__year AS metric_time__year + , subq_17.metric_time__extract_year AS metric_time__extract_year + , subq_17.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_17.metric_time__extract_month AS metric_time__extract_month + , subq_17.metric_time__extract_day AS metric_time__extract_day + , subq_17.metric_time__extract_dow AS metric_time__extract_dow + , subq_17.metric_time__extract_doy AS metric_time__extract_doy , subq_17.listing AS listing , subq_17.guest AS guest , subq_17.host AS host @@ -837,16 +837,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_15.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_15.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_15.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_15.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_15.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_15.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_15.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_15.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_15.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_15.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_15.metric_time__day) AS metric_time__extract_doy , subq_14.ds__day AS ds__day , subq_14.ds__week AS ds__week , subq_14.ds__month AS ds__month @@ -913,6 +903,16 @@ FROM ( , subq_14.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_14.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_14.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_14.metric_time__week AS metric_time__week + , subq_14.metric_time__month AS metric_time__month + , subq_14.metric_time__quarter AS metric_time__quarter + , subq_14.metric_time__year AS metric_time__year + , subq_14.metric_time__extract_year AS metric_time__extract_year + , subq_14.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_14.metric_time__extract_month AS metric_time__extract_month + , subq_14.metric_time__extract_day AS metric_time__extract_day + , subq_14.metric_time__extract_dow AS metric_time__extract_dow + , subq_14.metric_time__extract_doy AS metric_time__extract_doy , subq_14.listing AS listing , subq_14.guest AS guest , subq_14.host AS host diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_offset_metric_with_query_time_filters__plan0.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_offset_metric_with_query_time_filters__plan0.sql index ff34039aa..7083f023f 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_offset_metric_with_query_time_filters__plan0.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Snowflake/test_offset_metric_with_query_time_filters__plan0.sql @@ -606,16 +606,6 @@ FROM ( -- Constrain Output with WHERE SELECT subq_18.metric_time__day - , subq_18.metric_time__week - , subq_18.metric_time__month - , subq_18.metric_time__quarter - , subq_18.metric_time__year - , subq_18.metric_time__extract_year - , subq_18.metric_time__extract_quarter - , subq_18.metric_time__extract_month - , subq_18.metric_time__extract_day - , subq_18.metric_time__extract_dow - , subq_18.metric_time__extract_doy , subq_18.ds__day , subq_18.ds__week , subq_18.ds__month @@ -682,6 +672,16 @@ FROM ( , subq_18.booking__paid_at__extract_day , subq_18.booking__paid_at__extract_dow , subq_18.booking__paid_at__extract_doy + , subq_18.metric_time__week + , subq_18.metric_time__month + , subq_18.metric_time__quarter + , subq_18.metric_time__year + , subq_18.metric_time__extract_year + , subq_18.metric_time__extract_quarter + , subq_18.metric_time__extract_month + , subq_18.metric_time__extract_day + , subq_18.metric_time__extract_dow + , subq_18.metric_time__extract_doy , subq_18.listing , subq_18.guest , subq_18.host @@ -709,16 +709,6 @@ FROM ( SELECT subq_17.country_latest AS listing__country_latest , subq_14.metric_time__day AS metric_time__day - , subq_14.metric_time__week AS metric_time__week - , subq_14.metric_time__month AS metric_time__month - , subq_14.metric_time__quarter AS metric_time__quarter - , subq_14.metric_time__year AS metric_time__year - , subq_14.metric_time__extract_year AS metric_time__extract_year - , subq_14.metric_time__extract_quarter AS metric_time__extract_quarter - , subq_14.metric_time__extract_month AS metric_time__extract_month - , subq_14.metric_time__extract_day AS metric_time__extract_day - , subq_14.metric_time__extract_dow AS metric_time__extract_dow - , subq_14.metric_time__extract_doy AS metric_time__extract_doy , subq_14.ds__day AS ds__day , subq_14.ds__week AS ds__week , subq_14.ds__month AS ds__month @@ -785,6 +775,16 @@ FROM ( , subq_14.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_14.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_14.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_14.metric_time__week AS metric_time__week + , subq_14.metric_time__month AS metric_time__month + , subq_14.metric_time__quarter AS metric_time__quarter + , subq_14.metric_time__year AS metric_time__year + , subq_14.metric_time__extract_year AS metric_time__extract_year + , subq_14.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_14.metric_time__extract_month AS metric_time__extract_month + , subq_14.metric_time__extract_day AS metric_time__extract_day + , subq_14.metric_time__extract_dow AS metric_time__extract_dow + , subq_14.metric_time__extract_doy AS metric_time__extract_doy , subq_14.listing AS listing , subq_14.guest AS guest , subq_14.host AS host @@ -810,16 +810,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_12.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_12.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_12.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_12.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_12.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_12.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_12.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_12.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_12.metric_time__day) AS metric_time__extract_day - , EXTRACT(dayofweekiso FROM subq_12.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_12.metric_time__day) AS metric_time__extract_doy , subq_11.ds__day AS ds__day , subq_11.ds__week AS ds__week , subq_11.ds__month AS ds__month @@ -886,6 +876,16 @@ FROM ( , subq_11.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_11.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_11.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_11.metric_time__week AS metric_time__week + , subq_11.metric_time__month AS metric_time__month + , subq_11.metric_time__quarter AS metric_time__quarter + , subq_11.metric_time__year AS metric_time__year + , subq_11.metric_time__extract_year AS metric_time__extract_year + , subq_11.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_11.metric_time__extract_month AS metric_time__extract_month + , subq_11.metric_time__extract_day AS metric_time__extract_day + , subq_11.metric_time__extract_dow AS metric_time__extract_dow + , subq_11.metric_time__extract_doy AS metric_time__extract_doy , subq_11.listing AS listing , subq_11.guest AS guest , subq_11.host AS host diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql index 470312fbd..e4f3d7c56 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_fill_nulls_time_spine_metric_predicate_pushdown__plan0.sql @@ -633,16 +633,6 @@ FROM ( -- Constrain Output with WHERE SELECT subq_21.metric_time__day - , subq_21.metric_time__week - , subq_21.metric_time__month - , subq_21.metric_time__quarter - , subq_21.metric_time__year - , subq_21.metric_time__extract_year - , subq_21.metric_time__extract_quarter - , subq_21.metric_time__extract_month - , subq_21.metric_time__extract_day - , subq_21.metric_time__extract_dow - , subq_21.metric_time__extract_doy , subq_21.ds__day , subq_21.ds__week , subq_21.ds__month @@ -709,6 +699,16 @@ FROM ( , subq_21.booking__paid_at__extract_day , subq_21.booking__paid_at__extract_dow , subq_21.booking__paid_at__extract_doy + , subq_21.metric_time__week + , subq_21.metric_time__month + , subq_21.metric_time__quarter + , subq_21.metric_time__year + , subq_21.metric_time__extract_year + , subq_21.metric_time__extract_quarter + , subq_21.metric_time__extract_month + , subq_21.metric_time__extract_day + , subq_21.metric_time__extract_dow + , subq_21.metric_time__extract_doy , subq_21.listing , subq_21.guest , subq_21.host @@ -736,16 +736,6 @@ FROM ( SELECT subq_20.country_latest AS listing__country_latest , subq_17.metric_time__day AS metric_time__day - , subq_17.metric_time__week AS metric_time__week - , subq_17.metric_time__month AS metric_time__month - , subq_17.metric_time__quarter AS metric_time__quarter - , subq_17.metric_time__year AS metric_time__year - , subq_17.metric_time__extract_year AS metric_time__extract_year - , subq_17.metric_time__extract_quarter AS metric_time__extract_quarter - , subq_17.metric_time__extract_month AS metric_time__extract_month - , subq_17.metric_time__extract_day AS metric_time__extract_day - , subq_17.metric_time__extract_dow AS metric_time__extract_dow - , subq_17.metric_time__extract_doy AS metric_time__extract_doy , subq_17.ds__day AS ds__day , subq_17.ds__week AS ds__week , subq_17.ds__month AS ds__month @@ -812,6 +802,16 @@ FROM ( , subq_17.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_17.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_17.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_17.metric_time__week AS metric_time__week + , subq_17.metric_time__month AS metric_time__month + , subq_17.metric_time__quarter AS metric_time__quarter + , subq_17.metric_time__year AS metric_time__year + , subq_17.metric_time__extract_year AS metric_time__extract_year + , subq_17.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_17.metric_time__extract_month AS metric_time__extract_month + , subq_17.metric_time__extract_day AS metric_time__extract_day + , subq_17.metric_time__extract_dow AS metric_time__extract_dow + , subq_17.metric_time__extract_doy AS metric_time__extract_doy , subq_17.listing AS listing , subq_17.guest AS guest , subq_17.host AS host @@ -837,16 +837,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_15.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_15.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_15.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_15.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_15.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_15.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_15.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_15.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_15.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_15.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_15.metric_time__day) AS metric_time__extract_doy , subq_14.ds__day AS ds__day , subq_14.ds__week AS ds__week , subq_14.ds__month AS ds__month @@ -913,6 +903,16 @@ FROM ( , subq_14.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_14.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_14.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_14.metric_time__week AS metric_time__week + , subq_14.metric_time__month AS metric_time__month + , subq_14.metric_time__quarter AS metric_time__quarter + , subq_14.metric_time__year AS metric_time__year + , subq_14.metric_time__extract_year AS metric_time__extract_year + , subq_14.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_14.metric_time__extract_month AS metric_time__extract_month + , subq_14.metric_time__extract_day AS metric_time__extract_day + , subq_14.metric_time__extract_dow AS metric_time__extract_dow + , subq_14.metric_time__extract_doy AS metric_time__extract_doy , subq_14.listing AS listing , subq_14.guest AS guest , subq_14.host AS host diff --git a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_offset_metric_with_query_time_filters__plan0.sql b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_offset_metric_with_query_time_filters__plan0.sql index 2b83441e1..229c9671e 100644 --- a/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_offset_metric_with_query_time_filters__plan0.sql +++ b/tests_metricflow/snapshots/test_predicate_pushdown_rendering.py/SqlQueryPlan/Trino/test_offset_metric_with_query_time_filters__plan0.sql @@ -606,16 +606,6 @@ FROM ( -- Constrain Output with WHERE SELECT subq_18.metric_time__day - , subq_18.metric_time__week - , subq_18.metric_time__month - , subq_18.metric_time__quarter - , subq_18.metric_time__year - , subq_18.metric_time__extract_year - , subq_18.metric_time__extract_quarter - , subq_18.metric_time__extract_month - , subq_18.metric_time__extract_day - , subq_18.metric_time__extract_dow - , subq_18.metric_time__extract_doy , subq_18.ds__day , subq_18.ds__week , subq_18.ds__month @@ -682,6 +672,16 @@ FROM ( , subq_18.booking__paid_at__extract_day , subq_18.booking__paid_at__extract_dow , subq_18.booking__paid_at__extract_doy + , subq_18.metric_time__week + , subq_18.metric_time__month + , subq_18.metric_time__quarter + , subq_18.metric_time__year + , subq_18.metric_time__extract_year + , subq_18.metric_time__extract_quarter + , subq_18.metric_time__extract_month + , subq_18.metric_time__extract_day + , subq_18.metric_time__extract_dow + , subq_18.metric_time__extract_doy , subq_18.listing , subq_18.guest , subq_18.host @@ -709,16 +709,6 @@ FROM ( SELECT subq_17.country_latest AS listing__country_latest , subq_14.metric_time__day AS metric_time__day - , subq_14.metric_time__week AS metric_time__week - , subq_14.metric_time__month AS metric_time__month - , subq_14.metric_time__quarter AS metric_time__quarter - , subq_14.metric_time__year AS metric_time__year - , subq_14.metric_time__extract_year AS metric_time__extract_year - , subq_14.metric_time__extract_quarter AS metric_time__extract_quarter - , subq_14.metric_time__extract_month AS metric_time__extract_month - , subq_14.metric_time__extract_day AS metric_time__extract_day - , subq_14.metric_time__extract_dow AS metric_time__extract_dow - , subq_14.metric_time__extract_doy AS metric_time__extract_doy , subq_14.ds__day AS ds__day , subq_14.ds__week AS ds__week , subq_14.ds__month AS ds__month @@ -785,6 +775,16 @@ FROM ( , subq_14.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_14.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_14.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_14.metric_time__week AS metric_time__week + , subq_14.metric_time__month AS metric_time__month + , subq_14.metric_time__quarter AS metric_time__quarter + , subq_14.metric_time__year AS metric_time__year + , subq_14.metric_time__extract_year AS metric_time__extract_year + , subq_14.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_14.metric_time__extract_month AS metric_time__extract_month + , subq_14.metric_time__extract_day AS metric_time__extract_day + , subq_14.metric_time__extract_dow AS metric_time__extract_dow + , subq_14.metric_time__extract_doy AS metric_time__extract_doy , subq_14.listing AS listing , subq_14.guest AS guest , subq_14.host AS host @@ -810,16 +810,6 @@ FROM ( -- Join to Time Spine Dataset SELECT subq_12.metric_time__day AS metric_time__day - , DATE_TRUNC('week', subq_12.metric_time__day) AS metric_time__week - , DATE_TRUNC('month', subq_12.metric_time__day) AS metric_time__month - , DATE_TRUNC('quarter', subq_12.metric_time__day) AS metric_time__quarter - , DATE_TRUNC('year', subq_12.metric_time__day) AS metric_time__year - , EXTRACT(year FROM subq_12.metric_time__day) AS metric_time__extract_year - , EXTRACT(quarter FROM subq_12.metric_time__day) AS metric_time__extract_quarter - , EXTRACT(month FROM subq_12.metric_time__day) AS metric_time__extract_month - , EXTRACT(day FROM subq_12.metric_time__day) AS metric_time__extract_day - , EXTRACT(DAY_OF_WEEK FROM subq_12.metric_time__day) AS metric_time__extract_dow - , EXTRACT(doy FROM subq_12.metric_time__day) AS metric_time__extract_doy , subq_11.ds__day AS ds__day , subq_11.ds__week AS ds__week , subq_11.ds__month AS ds__month @@ -886,6 +876,16 @@ FROM ( , subq_11.booking__paid_at__extract_day AS booking__paid_at__extract_day , subq_11.booking__paid_at__extract_dow AS booking__paid_at__extract_dow , subq_11.booking__paid_at__extract_doy AS booking__paid_at__extract_doy + , subq_11.metric_time__week AS metric_time__week + , subq_11.metric_time__month AS metric_time__month + , subq_11.metric_time__quarter AS metric_time__quarter + , subq_11.metric_time__year AS metric_time__year + , subq_11.metric_time__extract_year AS metric_time__extract_year + , subq_11.metric_time__extract_quarter AS metric_time__extract_quarter + , subq_11.metric_time__extract_month AS metric_time__extract_month + , subq_11.metric_time__extract_day AS metric_time__extract_day + , subq_11.metric_time__extract_dow AS metric_time__extract_dow + , subq_11.metric_time__extract_doy AS metric_time__extract_doy , subq_11.listing AS listing , subq_11.guest AS guest , subq_11.host AS host